summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-14 11:03:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-14 18:13:48 +0000
commit0d2a50772200d868d094f90dc1d30c1b4d7930ba (patch)
tree01c19b13ec4cc98b756b98615afcdda51f8b4669
parentf3e0ba4f65db2b85f89aa3868d153434bc41c811 (diff)
sna/glyphs: Cache the glyph image on the fallback path as well
The glyph cache grew to accommodate the fallback pixman image for mask generation, and is equally applicable along the full fallback path. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_glyphs.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 95cc8c06..6efe8010 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -1106,19 +1106,29 @@ glyphs_fallback(CARD8 op,
y += list->yOff;
while (n--) {
GlyphPtr g = *glyphs++;
- PicturePtr picture;
pixman_image_t *glyph_image;
if (g->info.width == 0 || g->info.height == 0)
goto next_glyph;
- picture = GlyphPicture(g)[screen];
- if (picture == NULL)
- goto next_glyph;
+ glyph_image = sna_glyph(g)->image;
+ if (glyph_image == NULL) {
+ PicturePtr picture;
+ int dx, dy;
- glyph_image = image_from_pict(picture, FALSE, &dx, &dy);
- if (!glyph_image)
- goto next_glyph;
+ picture = GlyphPicture(g)[screen];
+ if (picture == NULL)
+ goto next_glyph;
+
+ glyph_image = image_from_pict(picture,
+ FALSE,
+ &dx, &dy);
+ if (!glyph_image)
+ goto next_glyph;
+
+ assert(dx == 0 && dy == 0);
+ sna_glyph(g)->image = glyph_image;
+ }
if (mask_format) {
DBG(("%s: glyph+(%d,%d) to mask (%d, %d)x(%d, %d)\n",
@@ -1163,8 +1173,6 @@ glyphs_fallback(CARD8 op,
g->info.width,
g->info.height);
}
- free_pixman_pict(picture, glyph_image);
-
next_glyph:
x += g->info.xOff;
y += g->info.yOff;