st-widget: Cache two paint states

In most cases, we'll transition between two states on hover / focus.
Instead of recalculating and repainting our resources on state change,
simply cache the last state when we transition.

https://bugzilla.gnome.org/show_bug.cgi?id=697274
This commit is contained in:
Jasper St. Pierre
2013-04-04 23:06:29 -04:00
parent db14dc973a
commit a2fcbb7e65
4 changed files with 50 additions and 15 deletions

View File

@@ -1965,7 +1965,10 @@ st_theme_node_paint (StThemeNode *node,
return;
if (state->alloc_width != width || state->alloc_height != height)
st_theme_node_render_resources (node, state, width, height);
{
state->node = node;
st_theme_node_render_resources (node, state, width, height);
}
/* Rough notes about the relationship of borders and backgrounds in CSS3;
* see http://www.w3.org/TR/css3-background/ for more accurate details.
@@ -2097,6 +2100,7 @@ st_theme_node_paint_state_init (StThemeNodePaintState *state)
{
int corner_id;
state->node = NULL;
state->box_shadow_material = COGL_INVALID_HANDLE;
state->prerendered_texture = COGL_INVALID_HANDLE;
state->prerendered_material = COGL_INVALID_HANDLE;
@@ -2116,6 +2120,8 @@ st_theme_node_paint_state_copy (StThemeNodePaintState *state,
st_theme_node_paint_state_free (state);
state->node = other->node;
state->alloc_width = other->alloc_width;
state->alloc_height = other->alloc_height;