themingbackground: Restructure code
Make if statements encompassing the whole function into early returns. The rest of the diff is reindenting.
This commit is contained in:
parent
016647edb1
commit
ce56248930
@ -149,20 +149,21 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
|
|||||||
GtkThemingBackgroundLayer *layer,
|
GtkThemingBackgroundLayer *layer,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
|
GtkCssRepeatStyle hrepeat, vrepeat;
|
||||||
|
const GtkCssValue *pos, *repeat;
|
||||||
|
double image_width, image_height;
|
||||||
|
double width, height;
|
||||||
|
|
||||||
|
if (layer->image == NULL
|
||||||
|
|| layer->image_rect.width <= 0
|
||||||
|
|| layer->image_rect.height <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
||||||
_gtk_rounded_box_path (&layer->clip_box, cr);
|
_gtk_rounded_box_path (&layer->clip_box, cr);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
if (layer->image
|
|
||||||
&& layer->image_rect.width > 0
|
|
||||||
&& layer->image_rect.height > 0)
|
|
||||||
{
|
|
||||||
const GtkCssValue *pos, *repeat;
|
|
||||||
double image_width, image_height;
|
|
||||||
double width, height;
|
|
||||||
GtkCssRepeatStyle hrepeat, vrepeat;
|
|
||||||
|
|
||||||
pos = _gtk_css_array_value_get_nth (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_POSITION), layer->idx);
|
pos = _gtk_css_array_value_get_nth (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_POSITION), layer->idx);
|
||||||
repeat = _gtk_css_array_value_get_nth (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_REPEAT), layer->idx);
|
repeat = _gtk_css_array_value_get_nth (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_REPEAT), layer->idx);
|
||||||
hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
|
hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
|
||||||
@ -299,7 +300,6 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
|
|||||||
fill_rect.width, fill_rect.height);
|
fill_rect.width, fill_rect.height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user