cssshadowvalue: Add a cache for blurred Pango layouts

Desktop / GNOME / GTK - Jasper St. Pierre [mecheye.net] - 5 October 2014 18:58 UTC

Drawing text with Pango is quite expensive, and drawing text and also blurring it is *really* expensive. To prevent us from drawing a lot of text and then blurring it a lot is *really* expensive.

We now cache the blurred pixels for the last layout and shadow we made, which means we can repeatedly draw labels with a blurred text-shadow extremely fast.

To detect whether the shadow is up-to-date, we track the serial of the PangoLayout alongside the radius of the box shadow. We don't support inset shadows nor spread on text-shadow, so we don't need to track these.

dadc37e cssshadowvalue: Add a cache for blurred Pango layouts
gtk/gtkcssshadowvalue.c | 122 ++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 110 insertions(+), 12 deletions(-)

Upstream: git.gnome.org


  • Share