[gtk+/wip/pango-shadow-cache: 3/5] move color / offset



commit 795a2d3d44feb619033b042aadd09f24ff71bda7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 29 13:54:43 2014 -0700

    move color / offset

 gtk/gtkcssshadowvalue.c |   33 ++++++---------------------------
 1 files changed, 6 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 56b1ea6..260ec17 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -321,6 +321,12 @@ gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
   cairo_t *blur_cr;
   gdouble radius, clip_radius;
 
+  gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
+
+  cairo_translate (cr,
+                   _gtk_css_number_value_get (shadow->hoffset, 0),
+                   _gtk_css_number_value_get (shadow->voffset, 0));
+
   radius = _gtk_css_number_value_get (shadow->radius, 0);
   if (radius == 0.0)
     return cr;
@@ -366,7 +372,6 @@ gtk_css_shadow_value_finish_drawing (const GtkCssValue *shadow,
   /* Blur the surface. */
   _gtk_cairo_blur_surface (surface, radius);
 
-  gdk_cairo_set_source_rgba (original_cr, _gtk_css_rgba_value_get_rgba (shadow->color));
   cairo_mask_surface (original_cr, surface, 0, 0);
 
   cairo_destroy (cr);
@@ -386,21 +391,9 @@ _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
     cairo_move_to (cr, 0, 0);
 
   cairo_save (cr);
-
-  cairo_rel_move_to (cr,
-                     _gtk_css_number_value_get (shadow->hoffset, 0),
-                     _gtk_css_number_value_get (shadow->voffset, 0));
-
-  gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
   cr = gtk_css_shadow_value_start_drawing (shadow, cr);
-
   _gtk_pango_fill_layout (cr, layout);
-
   cr = gtk_css_shadow_value_finish_drawing (shadow, cr);
-
-  cairo_rel_move_to (cr,
-                     - _gtk_css_number_value_get (shadow->hoffset, 0),
-                     - _gtk_css_number_value_get (shadow->voffset, 0));
   cairo_restore (cr);
 }
 
@@ -415,14 +408,8 @@ _gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
   cairo_save (cr);
   pattern = cairo_pattern_reference (cairo_get_source (cr));
 
-  gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
   cr = gtk_css_shadow_value_start_drawing (shadow, cr);
-
-  cairo_translate (cr,
-                   _gtk_css_number_value_get (shadow->hoffset, 0),
-                   _gtk_css_number_value_get (shadow->voffset, 0));
   cairo_mask (cr, pattern);
-
   cr = gtk_css_shadow_value_finish_drawing (shadow, cr);
 
   cairo_restore (cr);
@@ -438,17 +425,9 @@ _gtk_css_shadow_value_paint_spinner (const GtkCssValue *shadow,
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
   cairo_save (cr);
-
-  gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
   cr = gtk_css_shadow_value_start_drawing (shadow, cr);
-
-  cairo_translate (cr,
-                   _gtk_css_number_value_get (shadow->hoffset, 0),
-                   _gtk_css_number_value_get (shadow->voffset, 0));
   _gtk_theming_engine_paint_spinner (cr, radius, progress);
-
   cr = gtk_css_shadow_value_finish_drawing (shadow, cr);
-
   cairo_restore (cr);
 }
 


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