From 9122671ee1455e354fbbd7367f3839d9a3b6d16f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Feb 2024 07:47:41 -0500 Subject: [PATCH] Hack: glyph cache debugging Color the padding in the cache, and warn if glyphs extrude into it. --- gsk/gpu/gskgpuuploadop.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gsk/gpu/gskgpuuploadop.c b/gsk/gpu/gskgpuuploadop.c index d3aaf3df82..5f62934f7b 100644 --- a/gsk/gpu/gskgpuuploadop.c +++ b/gsk/gpu/gskgpuuploadop.c @@ -555,6 +555,25 @@ gsk_gpu_upload_glyph_op_draw (GskGpuOp *op, } } }); + for (int y = 0; y < self->area.height; y++) + { + int *row = (int *) (data + y * stride); + if (row[0] != 0 || row[self->area.width - 1] != 0) + g_warning ("glyph %u overflow", self->glyph); + row[0] = 0xff0000ff; + row[self->area.width - 1] = 0xff0000ff; + } + + for (int x = 0; x < self->area.width; x++) + { + int *row0 = (int *) data; + int * row1 = (int *) (data + (self->area.height - 1) * stride); + if (row0[x] != 0 || row1[x] != 0) + g_warning ("glyph %u overflow", self->glyph); + row0[x] = 0xff0000ff; + row1[x] = 0xff0000ff; + } + cairo_destroy (cr); cairo_surface_finish (surface);