[gimp] app: draw the about dialog's animated string with cairo, not gdk_draw_layout()



commit 9942d5f692ca6c99a96ae6a8454cda2a6a8a8a1a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 27 18:01:34 2010 +0200

    app: draw the about dialog's animated string with cairo, not gdk_draw_layout()

 app/dialogs/about-dialog.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 92c0082..04d8779 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -263,18 +263,19 @@ about_dialog_anim_expose (GtkWidget       *widget,
                           GimpAboutDialog *dialog)
 {
   GtkStyle      *style = gtk_widget_get_style (widget);
+  cairo_t       *cr;
   GtkAllocation  allocation;
-  GdkGC         *text_gc;
   gint           x, y;
   gint           width, height;
 
   if (! dialog->visible)
     return FALSE;
 
-  gtk_widget_get_allocation (widget, &allocation);
+  cr = gdk_cairo_create (event->window);
 
-  text_gc = style->text_gc[GTK_STATE_NORMAL];
+  gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
 
+  gtk_widget_get_allocation (widget, &allocation);
   pango_layout_get_pixel_size (dialog->layout, &width, &height);
 
   x = (allocation.width  - width)  / 2;
@@ -282,26 +283,25 @@ about_dialog_anim_expose (GtkWidget       *widget,
 
   if (dialog->textrange[1] > 0)
     {
-      GdkRegion *covered_region = NULL;
-      GdkRegion *rect_region;
+      GdkRegion *covered_region;
 
       covered_region = gdk_pango_layout_get_clip_region (dialog->layout,
                                                          x, y,
                                                          dialog->textrange, 1);
 
-      rect_region = gdk_region_rectangle (&event->area);
+      gdk_region_intersect (covered_region, event->region);
 
-      gdk_region_intersect (covered_region, rect_region);
-      gdk_region_destroy (rect_region);
+      gdk_cairo_region (cr, covered_region);
+      cairo_clip (cr);
 
-      gdk_gc_set_clip_region (text_gc, covered_region);
       gdk_region_destroy (covered_region);
     }
 
-  gdk_draw_layout (gtk_widget_get_window (widget),
-                   text_gc, x, y, dialog->layout);
+  cairo_move_to (cr, x, y);
+
+  pango_cairo_show_layout (cr, dialog->layout);
 
-  gdk_gc_set_clip_region (text_gc, NULL);
+  cairo_destroy (cr);
 
   return FALSE;
 }



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