[gtk+/wip/pango-shadow-cache: 6/9] cssshadowvalue: Move applying the color / offset into start_drawing
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/pango-shadow-cache: 6/9] cssshadowvalue: Move applying the color / offset into start_drawing
- Date: Sat, 30 Aug 2014 00:44:49 +0000 (UTC)
commit 4d5b1b7480582fb616e351a7de92c0fc34a438cb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Aug 29 13:54:43 2014 -0700
cssshadowvalue: Move applying the color / offset into start_drawing
Now that we've split out the complex case, draw_shadow, into its own
implementation, we can do this here.
gtk/gtkcssshadowvalue.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 04080e6..4e6d09d 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -322,6 +322,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;
@@ -367,7 +373,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);
@@ -388,20 +393,10 @@ _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
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);
}
@@ -416,14 +411,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);
@@ -439,17 +428,9 @@ _gtk_css_shadow_value_paint_spinner (const GtkCssValue *shadow,
g_return_if_fail (shadow->class == >K_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]