summaryrefslogtreecommitdiff
diff options
authorGord Allott <gord.allott@canonical.com>2011-04-07 15:04:20 +0100
committerGord Allott <gord.allott@canonical.com>2011-04-07 15:04:20 +0100
commit7c0271baa196b595bc83a536429e7d7a4073cdb0 (patch)
treeb5e3d7eadc0c1db66c77bdaecb5197f925f408d1
parent48ecc44dd6056fa010f96c043575b235504acb1e (diff)
parentc6e35a1f7cd3c724aceb22e35758effb5c905930 (diff)
merges in a fix for highlights being misaligned by one pixel
(bzr r1082)
-rw-r--r--src/PlacesTile.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/PlacesTile.cpp b/src/PlacesTile.cpp
index ddeab7ec4..5112a7093 100644
--- a/src/PlacesTile.cpp
+++ b/src/PlacesTile.cpp
@@ -26,7 +26,7 @@
#include "PlacesTile.h"
#define PADDING 8
-#define BLUR_SIZE 5
+#define BLUR_SIZE 6
PlacesTile::PlacesTile (NUX_FILE_LINE_DECL, const void *id) :
View (NUX_FILE_LINE_PARAM),
@@ -85,6 +85,7 @@ PlacesTile::DrawHighlight (const char *texid, int width, int height, nux::BaseTe
{
nux::Geometry base = GetGeometry ();
nux::Geometry highlight_geo = GetHighlightGeometry ();
+
nux::CairoGraphics *cairo_graphics = new nux::CairoGraphics (CAIRO_FORMAT_ARGB32,
highlight_geo.width + PADDING + (BLUR_SIZE*3),
highlight_geo.height + PADDING + (BLUR_SIZE*3));
@@ -96,10 +97,10 @@ PlacesTile::DrawHighlight (const char *texid, int width, int height, nux::BaseTe
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
- int bg_width = highlight_geo.width + PADDING;
- int bg_height = highlight_geo.height + PADDING;
- int bg_x = BLUR_SIZE;
- int bg_y = BLUR_SIZE;
+ int bg_width = highlight_geo.width + PADDING + 1;
+ int bg_height = highlight_geo.height + PADDING +1;
+ int bg_x = BLUR_SIZE-1;
+ int bg_y = BLUR_SIZE-1;
// draw the glow
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -255,10 +256,10 @@ PlacesTile::Draw (nux::GraphicsEngine& gfxContext,
{
UpdateBackground ();
nux::Geometry hl_geo = GetHighlightGeometry ();
- nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - (PADDING)/2 - BLUR_SIZE - 1,
- base.y + hl_geo.y - (PADDING)/2 - BLUR_SIZE - 1,
- hl_geo.width + PADDING + 1 + BLUR_SIZE*2,
- hl_geo.height + PADDING + 1 + BLUR_SIZE*2);
+ nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - (PADDING)/2 - BLUR_SIZE,
+ base.y + hl_geo.y - (PADDING)/2 - BLUR_SIZE,
+ hl_geo.width + PADDING + BLUR_SIZE*2,
+ hl_geo.height + PADDING + BLUR_SIZE*2);
_hilight_layer->SetGeometry (total_highlight_geo);
nux::GetPainter ().RenderSinglePaintLayer (gfxContext, total_highlight_geo, _hilight_layer);
@@ -279,10 +280,10 @@ PlacesTile::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
UpdateBackground ();
nux::Geometry hl_geo = GetHighlightGeometry ();
- nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - (PADDING)/2 - BLUR_SIZE - 1,
- base.y + hl_geo.y - (PADDING)/2 - BLUR_SIZE - 1,
- hl_geo.width + PADDING + 1 + BLUR_SIZE*2,
- hl_geo.height + PADDING + 1 + BLUR_SIZE*2);
+ nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - (PADDING)/2 - BLUR_SIZE,
+ base.y + hl_geo.y - (PADDING)/2 - BLUR_SIZE,
+ hl_geo.width + PADDING + BLUR_SIZE*2,
+ hl_geo.height + PADDING + BLUR_SIZE*2);
nux::GetPainter ().PushLayer (GfxContext, total_highlight_geo, _hilight_layer);
}