forked from AuroraMiddleware/gtk
snapshot: Avoid a save/restore pair if we can
This commit is contained in:
parent
aad67743b9
commit
f4acde371e
@ -1721,6 +1721,7 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
gdouble y,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
const bool needs_translate = (x != 0 || y != 0);
|
||||
const GdkRGBA *fg_color;
|
||||
GtkCssValue *shadows_value;
|
||||
gboolean has_shadow;
|
||||
@ -1729,8 +1730,11 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
|
||||
if (needs_translate)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
|
||||
}
|
||||
|
||||
fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
@ -1742,6 +1746,7 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
if (has_shadow)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
if (needs_translate)
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user