Notice style transitions that don't change how StThemeNode paints

Add st_theme_node_paint_equal() and use that to do two things:

 1) Avoid animating transitions where nothing changes.
 2) Copy cached painting state from the old theme node to the new
    theme node.

https://bugzilla.gnome.org/show_bug.cgi?id=627083
This commit is contained in:
Owen W. Taylor
2010-08-26 14:10:46 -04:00
parent b9f9dd948a
commit 5e7c25e136
9 changed files with 210 additions and 3 deletions

View File

@ -77,6 +77,37 @@ st_shadow_free (StShadow *shadow)
g_slice_free (StShadow, shadow);
}
/**
* st_shadow_equal:
* @shadow: a #StShadow
* @other: a different #StShadow
*
* Check if two shadow objects are identical. Note that two shadows may
* compare non-identically if they differ only by floating point rounding
* errors.
*
* Return value: %TRUE if the two shadows are identical
*/
gboolean
st_shadow_equal (StShadow *shadow,
StShadow *other)
{
g_return_val_if_fail (shadow != NULL, FALSE);
g_return_val_if_fail (other != NULL, FALSE);
/* We use strict equality to compare double quantities; this means
* that, for example, a shadow offset of 0.25in does not necessarily
* compare equal to a shadow offset of 18pt in this test. Assume
* that a few false negatives are mostly harmless.
*/
return (clutter_color_equal (&shadow->color, &other->color) &&
shadow->xoffset == other->xoffset &&
shadow->yoffset == other->yoffset &&
shadow->blur == other->blur &&
shadow->spread == other->spread);
}
/**
* st_shadow_get_box:
* @shadow: a #StShadow
@ -105,7 +136,6 @@ st_shadow_get_box (StShadow *shadow,
+ shadow->blur + shadow->spread;
}
GType
st_shadow_get_type (void)
{