[gimp] app: cairo_translate() by allocation.x, y instead of doing that when drawing



commit 756b7310e7096c5d481f87c9f9a8baa48d1af109
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 13:02:05 2010 +0200

    app: cairo_translate() by allocation.x,y instead of doing that when drawing

 app/widgets/gimpcolorframe.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index bf5a5e8..02977b3 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -285,6 +285,11 @@ gimp_color_frame_expose (GtkWidget      *widget,
       gtk_widget_get_allocation (frame->color_area, &color_area_allocation);
 
       cr = gdk_cairo_create (gtk_widget_get_window (widget));
+      gdk_cairo_region (cr, eevent->region);
+      cairo_clip (cr);
+
+      cairo_translate (cr, allocation.x, allocation.y);
+
       gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
 
       g_snprintf (buf, sizeof (buf), "%d", frame->number);
@@ -303,10 +308,8 @@ gimp_color_frame_expose (GtkWidget      *widget,
       cairo_scale (cr, scale, scale);
 
       cairo_move_to (cr,
-                     (allocation.x +
-                      allocation.width / 2.0) / scale - w / 2.0,
-                     (allocation.y +
-                      allocation.height / 2.0 +
+                     (allocation.width / 2.0) / scale - w / 2.0,
+                     (allocation.height / 2.0 +
                       menu_allocation.height / 2.0 +
                       color_area_allocation.height / 2.0) / scale - h / 2.0);
       pango_cairo_show_layout (cr, frame->number_layout);



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