[maemo-commits] [maemo-commits] r13384 - in projects/haf/trunk/sapwood: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Aug 23 18:12:37 EEST 2007
Author: tko
Date: 2007-08-23 18:12:35 +0300 (Thu, 23 Aug 2007)
New Revision: 13384

Modified:
   projects/haf/trunk/sapwood/ChangeLog
   projects/haf/trunk/sapwood/src/sapwood-render.c
Log:
When painting centered pixmaps don't expand

2007-08-23  Tommi Komulainen  <tommi.komulainen at nokia.com>

	* src/sapwood-render.c (theme_pixbuf_render): When painting centered
	pixmaps don't expand but draw at most the size of the pixmap. Fixes
	uninitialized garbage appearing on screen when painting an arrow that
	is downscaled only in one direction.


Modified: projects/haf/trunk/sapwood/ChangeLog
===================================================================
--- projects/haf/trunk/sapwood/ChangeLog	2007-08-23 15:03:18 UTC (rev 13383)
+++ projects/haf/trunk/sapwood/ChangeLog	2007-08-23 15:12:35 UTC (rev 13384)
@@ -1,5 +1,12 @@
 2007-08-23  Tommi Komulainen  <tommi.komulainen at nokia.com>
 
+	* src/sapwood-render.c (theme_pixbuf_render): When painting centered
+	pixmaps don't expand but draw at most the size of the pixmap. Fixes
+	uninitialized garbage appearing on screen when painting an arrow that
+	is downscaled only in one direction.
+
+2007-08-23  Tommi Komulainen  <tommi.komulainen at nokia.com>
+
 	* src/sapwood-pixmap.c (sapwood_pixmap_render_rects_internal): handle
 	mask == NULL without generating warnings
 

Modified: projects/haf/trunk/sapwood/src/sapwood-render.c
===================================================================
--- projects/haf/trunk/sapwood/src/sapwood-render.c	2007-08-23 15:03:18 UTC (rev 13383)
+++ projects/haf/trunk/sapwood/src/sapwood-render.c	2007-08-23 15:12:35 UTC (rev 13384)
@@ -267,12 +267,12 @@
 
   pixmap = theme_pixbuf_get_pixmap (theme_pb);
 
-  /* if we do scaling we want to draw at least the whole pixmap */
-  draw_width  = MAX(width, pixbuf_width);
-  draw_height = MAX(height, pixbuf_height);
-
   if (theme_pb->stretch)
     {
+      /* if we do scaling we want to draw at least the whole pixmap */
+      draw_width  = MAX(width, pixbuf_width);
+      draw_height = MAX(height, pixbuf_height);
+
       dest_x[0] = x;
       dest_x[1] = x + theme_pb->border_left;
       dest_x[2] = x + draw_width - theme_pb->border_right;
@@ -377,9 +377,13 @@
     }
   else if (center)
     {
-      x += (draw_width - pixbuf_width) / 2;
-      y += (draw_height - pixbuf_height) / 2;
+      /* when centering don't expand beyond pixbuf size */
+      draw_width = MIN(width, pixbuf_width);
+      draw_height = MIN(height, pixbuf_height);
 
+      x += (width - draw_width) / 2;
+      y += (height - draw_height) / 2;
+
       sapwood_pixmap_get_pixmap (pixmap, 1, 1,
                                  &rect[0].pixmap, &rect[0].pixmask);
       rect[0].dest.x = x;
@@ -388,7 +392,7 @@
       rect[0].dest.height = pixbuf_height;
 
       sapwood_pixmap_render_rects (pixmap,
-                                   window, x, y, width, height,
+                                   window, x, y, draw_width, draw_height,
                                    mask, x, y, FALSE,
                                    clip_rect, 1, rect);
     }


More information about the maemo-commits mailing list