From 0ccb2800089822ac200cb20a2bbfddf1c31bbf4b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 2 Oct 2011 12:58:19 -0400 Subject: [PATCH] st-theme-node-drawing: Fix centering when the image needs to be scaled The translate coordinates are calculated as the offset after the scale, so it needs to be applied after the scale as well. This fixes random centering issues in the UI. https://bugzilla.gnome.org/show_bug.cgi?id=660674 --- src/st/st-theme-node-drawing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c index 7513a48f9..3e7d86f4e 100644 --- a/src/st/st-theme-node-drawing.c +++ b/src/st/st-theme-node-drawing.c @@ -601,8 +601,8 @@ create_cairo_pattern_of_background_image (StThemeNode *node, x_offset = - (node->alloc_width / 2. - scaled_width / 2.); } - cairo_matrix_init_translate (&matrix, x_offset, y_offset); - cairo_matrix_scale (&matrix, scale_factor, scale_factor); + cairo_matrix_init_scale (&matrix, scale_factor, scale_factor); + cairo_matrix_translate (&matrix, x_offset, y_offset); cairo_pattern_set_matrix (pattern, &matrix);