gpu: Take color state into account for glyph lookup

Add a 'linear' bit to the glyph cache key, so we can get have
separate cached images for the two cases. Note that the image
tagging with color state is ignored here - we simply copy the
glyph image out of the atlas as-is, and rely on the cache to
give use the right color state.
This commit is contained in:
Matthias Clasen
2024-06-08 09:01:46 -04:00
parent b27eaa344b
commit fb5d69fc02
3 changed files with 6 additions and 1 deletions

View File

@@ -977,6 +977,7 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
gsk_gpu_upload_glyph_op (frame,
cache->image,
(flags & GSK_GPU_GLYPH_LINEAR) != 0,
scaled_font,
glyph,
&(cairo_rectangle_int_t) {

View File

@@ -88,7 +88,8 @@ typedef enum
GSK_GPU_GLYPH_X_OFFSET_3 = 0x3,
GSK_GPU_GLYPH_Y_OFFSET_1 = 0x4,
GSK_GPU_GLYPH_Y_OFFSET_2 = 0x8,
GSK_GPU_GLYPH_Y_OFFSET_3 = 0xC
GSK_GPU_GLYPH_Y_OFFSET_3 = 0xC,
GSK_GPU_GLYPH_LINEAR = 0x10,
} GskGpuGlyphLookupFlags;
GskGpuImage * gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,

View File

@@ -3185,6 +3185,9 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
glyph_origin.x *= inv_align_scale_x;
glyph_origin.y *= inv_align_scale_y;
if (gdk_color_state_is_linear (self->color_state))
flags |= GSK_GPU_GLYPH_LINEAR;
image = gsk_gpu_device_lookup_glyph_image (device,
self->frame,
font,