mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
Atempt to fix stretched 9slice rendering
This commit is contained in:
parent
30fe448750
commit
4c04d944e8
@ -213,6 +213,7 @@ render_border (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr, x, y, width, height);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -222,24 +223,22 @@ render_border (cairo_t *cr,
|
||||
{
|
||||
d = cairo_image_surface_get_width (surface);
|
||||
|
||||
cairo_translate (cr, x + (width / 2), y);
|
||||
cairo_scale (cr, width / d, 1);
|
||||
cairo_set_source_surface (cr, surface, - d / 2, 0);
|
||||
cairo_rectangle (cr, - width / 2, 0, width, height);
|
||||
cairo_translate (cr, x, y);
|
||||
cairo_scale (cr, width / d, 1.0);
|
||||
cairo_set_source_surface (cr, surface, 0.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
d = cairo_image_surface_get_height (surface);
|
||||
|
||||
cairo_translate (cr, x, y + (height / 2));
|
||||
cairo_scale (cr, 1, height / d);
|
||||
cairo_set_source_surface (cr, surface, 0, - d / 2);
|
||||
cairo_rectangle (cr, 0, - height / 2, width, height);
|
||||
cairo_translate (cr, x, y);
|
||||
cairo_scale (cr, 1.0, height / d);
|
||||
cairo_set_source_surface (cr, surface, 0.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
}
|
||||
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
@ -282,7 +281,7 @@ gtk_9slice_render (Gtk9Slice *slice,
|
||||
|
||||
render_border (cr, surface, SIDE_TOP,
|
||||
x + slice->distances[SIDE_LEFT], y,
|
||||
(gdouble) width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
|
||||
width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
|
||||
(gdouble) img_height,
|
||||
slice->modifiers[SIDE_TOP]);
|
||||
|
||||
@ -292,7 +291,7 @@ gtk_9slice_render (Gtk9Slice *slice,
|
||||
|
||||
render_border (cr, surface, SIDE_BOTTOM,
|
||||
x + slice->distances[SIDE_LEFT], y + height - img_height,
|
||||
(gdouble) width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
|
||||
width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
|
||||
(gdouble) img_height,
|
||||
slice->modifiers[SIDE_BOTTOM]);
|
||||
|
||||
@ -303,7 +302,7 @@ gtk_9slice_render (Gtk9Slice *slice,
|
||||
render_border (cr, surface, SIDE_LEFT,
|
||||
x, y + slice->distances[SIDE_TOP],
|
||||
(gdouble) img_width,
|
||||
(gdouble) height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
|
||||
height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
|
||||
slice->modifiers[SIDE_LEFT]);
|
||||
|
||||
/* Right side */
|
||||
@ -312,7 +311,8 @@ gtk_9slice_render (Gtk9Slice *slice,
|
||||
|
||||
render_border (cr, surface, SIDE_RIGHT,
|
||||
x + width - img_width, y + slice->distances[SIDE_TOP],
|
||||
(gdouble) img_width, height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
|
||||
(gdouble) img_width,
|
||||
height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
|
||||
slice->modifiers[SIDE_RIGHT]);
|
||||
|
||||
/* Top/Left corner */
|
||||
|
Loading…
Reference in New Issue
Block a user