mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-08 15:20:24 +01:00
xcb: Cache whether we have already check a glyph for size.
Avoid repeated cairo_scaled_glyph_lookup() and checking of sizes if we have already seen this glyph in this run.
This commit is contained in:
parent
1c76e3e9ad
commit
5c4b6d520b
1 changed files with 10 additions and 0 deletions
|
|
@ -3603,14 +3603,22 @@ _can_composite_glyphs (cairo_xcb_surface_t *dst,
|
|||
cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
unsigned long glyph_cache[64];
|
||||
cairo_status_t status;
|
||||
const int max_glyph_size = dst->connection->maximum_request_length - 64;
|
||||
int i;
|
||||
|
||||
memset (glyph_cache, 0, sizeof (glyph_cache));
|
||||
|
||||
/* first scan for oversized glyphs, and fallback in that case */
|
||||
for (i = 0; i < num_glyphs; i++) {
|
||||
cairo_scaled_glyph_t *scaled_glyph;
|
||||
int width, height, len;
|
||||
int g;
|
||||
|
||||
g = glyphs[i].index % ARRAY_LENGTH (glyph_cache);
|
||||
if (glyph_cache[g] == glyphs[i].index)
|
||||
continue;
|
||||
|
||||
status = _cairo_scaled_glyph_lookup (scaled_font,
|
||||
glyphs[i].index,
|
||||
|
|
@ -3629,6 +3637,8 @@ _can_composite_glyphs (cairo_xcb_surface_t *dst,
|
|||
len = CAIRO_STRIDE_FOR_WIDTH_BPP (width, 32) * height;
|
||||
if (len >= max_glyph_size)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
glyph_cache[g] = glyphs[i].index;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue