[gnome-themes-standard] engine: don't use style_pattern_set_matrix()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-themes-standard] engine: don't use style_pattern_set_matrix()
- Date: Fri, 2 Dec 2011 16:40:20 +0000 (UTC)
commit 07a766eda6fdfb3056520d91b43b5b681c3e785d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Dec 2 11:39:36 2011 -0500
engine: don't use style_pattern_set_matrix()
But scale the cairo context twice to scale the pattern, like
GtkThemingEngine does.
src/adwaita_engine.c | 10 +++++++---
src/adwaita_utils.c | 31 -------------------------------
src/adwaita_utils.h | 6 ------
3 files changed, 7 insertions(+), 40 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 6ae3de0..282675e 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -335,8 +335,9 @@ render_notebook_extension (GtkThemingEngine *engine,
if (state & GTK_STATE_FLAG_ACTIVE)
{
- style_pattern_set_matrix (pattern, width, height - 6.0, FALSE);
+ cairo_scale (cr, width, height - 6.0);
cairo_set_source (cr, pattern);
+ cairo_scale (cr, 1.0 / width, 1.0 / (height - 6.0));
}
else
{
@@ -566,9 +567,12 @@ adwaita_engine_render_activity (GtkThemingEngine *engine,
if (pattern != NULL)
{
- style_pattern_set_matrix (pattern, 20, 20, TRUE);
- cairo_rectangle (cr, x, y, width, height);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+ cairo_scale (cr, 20, 20);
cairo_set_source (cr, pattern);
+ cairo_scale (cr, 1.0 / 20, 1.0 / 20);
+
+ cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
diff --git a/src/adwaita_utils.c b/src/adwaita_utils.c
index bd70616..447f5b1 100644
--- a/src/adwaita_utils.c
+++ b/src/adwaita_utils.c
@@ -146,34 +146,3 @@ _cairo_round_rectangle_sides (cairo_t *cr,
cairo_arc (cr, x + width - radius, y + radius, radius, 3 * (G_PI / 2), - G_PI / 4);
}
}
-
-/* Set the appropriate matrix for
- * patterns coming from the style context
- */
-void
-style_pattern_set_matrix (cairo_pattern_t *pattern,
- gdouble width,
- gdouble height,
- gboolean repeat)
-{
- cairo_matrix_t matrix;
- gint w, h;
-
- if (cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SURFACE)
- {
- cairo_surface_t *surface;
-
- cairo_pattern_get_surface (pattern, &surface);
- w = cairo_image_surface_get_width (surface);
- h = cairo_image_surface_get_height (surface);
- }
- else
- w = h = 1;
-
- cairo_matrix_init_scale (&matrix, (gdouble) w / width, (gdouble) h / height);
- cairo_pattern_set_matrix (pattern, &matrix);
-
- if (repeat)
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-}
-
diff --git a/src/adwaita_utils.h b/src/adwaita_utils.h
index d630a81..7bf64a5 100644
--- a/src/adwaita_utils.h
+++ b/src/adwaita_utils.h
@@ -44,12 +44,6 @@ adwaita_trim_allocation_for_scale (GtkThemingEngine *engine,
gdouble *height);
void
-style_pattern_set_matrix (cairo_pattern_t *pattern,
- gdouble width,
- gdouble height,
- gboolean repeat);
-
-void
_cairo_round_rectangle_sides (cairo_t *cr,
gdouble radius,
gdouble x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]