themingbackground: Don't store (almost) unused variables
Instead, parse them directly to the one function that uses them.
This commit is contained in:
parent
6e68237191
commit
5cdb9752a7
@ -50,10 +50,7 @@ typedef struct _GtkThemingBackground GtkThemingBackground;
|
|||||||
struct _GtkThemingBackground {
|
struct _GtkThemingBackground {
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
cairo_rectangle_t paint_area;
|
|
||||||
GtkRoundedBox boxes[N_BOXES];
|
GtkRoundedBox boxes[N_BOXES];
|
||||||
|
|
||||||
GtkJunctionSides junction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -271,7 +268,10 @@ _gtk_theming_background_apply_shadow (GtkThemingBackground *bg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gtk_theming_background_init_context (GtkThemingBackground *bg)
|
_gtk_theming_background_init_context (GtkThemingBackground *bg,
|
||||||
|
double width,
|
||||||
|
double height,
|
||||||
|
GtkJunctionSides junction)
|
||||||
{
|
{
|
||||||
GtkStateFlags flags = gtk_style_context_get_state (bg->context);
|
GtkStateFlags flags = gtk_style_context_get_state (bg->context);
|
||||||
GtkBorder border, padding;
|
GtkBorder border, padding;
|
||||||
@ -287,8 +287,8 @@ _gtk_theming_background_init_context (GtkThemingBackground *bg)
|
|||||||
* In the future we might want to support different origins or clips, but
|
* In the future we might want to support different origins or clips, but
|
||||||
* right now we just shrink to the default.
|
* right now we just shrink to the default.
|
||||||
*/
|
*/
|
||||||
_gtk_rounded_box_init_rect (&bg->boxes[GTK_CSS_AREA_BORDER_BOX], 0, 0, bg->paint_area.width, bg->paint_area.height);
|
_gtk_rounded_box_init_rect (&bg->boxes[GTK_CSS_AREA_BORDER_BOX], 0, 0, width, height);
|
||||||
_gtk_rounded_box_apply_border_radius_for_context (&bg->boxes[GTK_CSS_AREA_BORDER_BOX], bg->context, bg->junction);
|
_gtk_rounded_box_apply_border_radius_for_context (&bg->boxes[GTK_CSS_AREA_BORDER_BOX], bg->context, junction);
|
||||||
|
|
||||||
bg->boxes[GTK_CSS_AREA_PADDING_BOX] = bg->boxes[GTK_CSS_AREA_BORDER_BOX];
|
bg->boxes[GTK_CSS_AREA_PADDING_BOX] = bg->boxes[GTK_CSS_AREA_BORDER_BOX];
|
||||||
_gtk_rounded_box_shrink (&bg->boxes[GTK_CSS_AREA_PADDING_BOX],
|
_gtk_rounded_box_shrink (&bg->boxes[GTK_CSS_AREA_PADDING_BOX],
|
||||||
@ -317,20 +317,13 @@ gtk_theming_background_render (GtkStyleContext *context,
|
|||||||
|
|
||||||
bg.context = context;
|
bg.context = context;
|
||||||
|
|
||||||
bg.paint_area.x = x;
|
_gtk_theming_background_init_context (&bg, width, height, junction);
|
||||||
bg.paint_area.y = y;
|
|
||||||
bg.paint_area.width = width;
|
|
||||||
bg.paint_area.height = height;
|
|
||||||
|
|
||||||
bg.junction = junction;
|
|
||||||
|
|
||||||
_gtk_theming_background_init_context (&bg);
|
|
||||||
|
|
||||||
background_image = _gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
|
background_image = _gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
|
||||||
bg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
|
bg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, bg.paint_area.x, bg.paint_area.y);
|
cairo_translate (cr, x, y);
|
||||||
|
|
||||||
_gtk_theming_background_apply_shadow (&bg, cr, FALSE); /* Outset shadow */
|
_gtk_theming_background_apply_shadow (&bg, cr, FALSE); /* Outset shadow */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user