[gimp] app: clean up GimpColorBar rendering and add cairo_surface_mark_dirty()



commit 7df1a4f3df72fdefb51578b242b2a5c2dfcb1f48
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jul 30 16:25:08 2010 +0200

    app: clean up GimpColorBar rendering and add cairo_surface_mark_dirty()

 app/widgets/gimpcolorbar.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimpcolorbar.c b/app/widgets/gimpcolorbar.c
index 516573e..0e9b2ac 100644
--- a/app/widgets/gimpcolorbar.c
+++ b/app/widgets/gimpcolorbar.c
@@ -160,7 +160,8 @@ gimp_color_bar_expose (GtkWidget      *widget,
   GtkAllocation    allocation;
   cairo_surface_t *surface;
   cairo_pattern_t *pattern;
-  guchar          *b;
+  guchar          *src;
+  guchar          *dest;
   gint             x, y;
   gint             width, height;
   gint             i;
@@ -186,15 +187,15 @@ gimp_color_bar_expose (GtkWidget      *widget,
 
   surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 256, 1);
 
-  for (i = 0, b = cairo_image_surface_get_data (surface);
+  for (i = 0, src = bar->buf, dest = cairo_image_surface_get_data (surface);
        i < 256;
-       i++, b += 4)
+       i++, src += 3, dest += 4)
     {
-      const guchar *src = bar->buf + 3 * i;
-
-      GIMP_CAIRO_RGB24_SET_PIXEL(b, src[0], src[1], src[2]);
+      GIMP_CAIRO_RGB24_SET_PIXEL(dest, src[0], src[1], src[2]);
     }
 
+  cairo_surface_mark_dirty (surface);
+
   pattern = cairo_pattern_create_for_surface (surface);
   cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);
   cairo_surface_destroy (surface);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]