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
This commit is contained in:
Jasper St. Pierre 2011-10-02 12:58:19 -04:00
parent 28c3e0693e
commit 0ccb280008

View File

@ -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);