[gimp] app: draw the statusbar's icon with cairo



commit ac801637712492c996f4bd7ffea7ac0474f59b45
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jul 30 13:14:10 2010 +0200

    app: draw the statusbar's icon with cairo

 app/display/gimpstatusbar.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 52ebc9b..ab23ecf 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -1330,9 +1330,15 @@ gimp_statusbar_label_expose (GtkWidget      *widget,
 {
   if (statusbar->icon)
     {
+      cairo_t        *cr;
       PangoRectangle  rect;
       gint            x, y;
 
+      cr = gdk_cairo_create (event->window);
+
+      gdk_cairo_region (cr, event->region);
+      cairo_clip (cr);
+
       gtk_label_get_layout_offsets (GTK_LABEL (widget), &x, &y);
 
       pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (widget)), 0,
@@ -1343,14 +1349,10 @@ gimp_statusbar_label_expose (GtkWidget      *widget,
                                     PANGO_PIXELS (rect.width) : 0);
       y += PANGO_PIXELS (rect.y);
 
-      gdk_draw_pixbuf (gtk_widget_get_window (widget),
-                       gtk_widget_get_style (widget)->black_gc,
-                       statusbar->icon,
-                       0, 0,
-                       x, y,
-                       gdk_pixbuf_get_width (statusbar->icon),
-                       gdk_pixbuf_get_height (statusbar->icon),
-                       GDK_RGB_DITHER_NORMAL, 0, 0);
+      gdk_cairo_set_source_pixbuf (cr, statusbar->icon, x, y);
+      cairo_paint (cr);
+
+      cairo_destroy (cr);
     }
 
   return FALSE;



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