[gtk+] shadow: Redo shadow implementation for rotations



commit 962ecc6fa5de06dda2c586c03c5b6e1d0c6afea3
Author: Benjamin Otte <otte redhat com>
Date:   Sun May 22 04:24:23 2011 +0200

    shadow: Redo shadow implementation for rotations
    
    The shadows went bonkers when the labels were rotated

 gtk/gtkshadow.c        |    8 +++++---
 gtk/gtkshadowprivate.h |    2 --
 gtk/gtkthemingengine.c |    5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkshadow.c b/gtk/gtkshadow.c
index 89702c0..f1f58c8 100644
--- a/gtk/gtkshadow.c
+++ b/gtk/gtkshadow.c
@@ -258,13 +258,14 @@ _gtk_shadow_to_string (GtkShadow *shadow)
 void
 _gtk_text_shadow_paint_layout (GtkShadow       *shadow,
                                cairo_t         *cr,
-                               gdouble          x,
-                               gdouble          y,
                                PangoLayout     *layout)
 {
   GList *l;
   GtkShadowElement *element;
 
+  if (!cairo_has_current_point (cr))
+    cairo_move_to (cr, 0, 0);
+
   /* render shadows starting from the last one,
    * and the others on top.
    */
@@ -274,10 +275,11 @@ _gtk_text_shadow_paint_layout (GtkShadow       *shadow,
 
       cairo_save (cr);
 
-      cairo_move_to (cr, x + element->hoffset, y + element->voffset);
+      cairo_rel_move_to (cr, element->hoffset, element->voffset);
       gdk_cairo_set_source_rgba (cr, &element->color);
       _gtk_pango_fill_layout (cr, layout);
 
+      cairo_rel_move_to (cr, -element->hoffset, -element->voffset);
       cairo_restore (cr);
   }
 }
diff --git a/gtk/gtkshadowprivate.h b/gtk/gtkshadowprivate.h
index 846b1d3..46ef0ff 100644
--- a/gtk/gtkshadowprivate.h
+++ b/gtk/gtkshadowprivate.h
@@ -55,8 +55,6 @@ gboolean   _gtk_shadow_get_resolved   (GtkShadow          *shadow);
 
 void       _gtk_text_shadow_paint_layout (GtkShadow       *shadow,
                                           cairo_t         *cr,
-                                          gdouble          x,
-                                          gdouble          y,
                                           PangoLayout     *layout);
 
 G_END_DECLS
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 4ae5904..47833a3 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -2429,13 +2429,14 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
                           "text-shadow", &text_shadow,
                           NULL);
 
+  prepare_context_for_layout (cr, x, y, layout);
+
   if (text_shadow != NULL)
     {
-      _gtk_text_shadow_paint_layout (text_shadow, cr, x, y, layout);
+      _gtk_text_shadow_paint_layout (text_shadow, cr, layout);
       _gtk_shadow_unref (text_shadow);
     }
 
-  prepare_context_for_layout (cr, x, y, layout);
   gdk_cairo_set_source_rgba (cr, &fg_color);
   pango_cairo_show_layout (cr, layout);
 



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