gsk: Drop the glyph-align flag

It wasn't doing anymore what it was designed for, and we are not
sure that we need it.
This commit is contained in:
Matthias Clasen
2024-03-13 00:18:59 -04:00
parent ab67936a64
commit cb92778478
3 changed files with 5 additions and 23 deletions

View File

@@ -3000,7 +3000,6 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
guint i, num_glyphs;
float scale, inv_scale;
GdkRGBA color;
gboolean glyph_align;
gboolean hinting;
if (self->opacity < 1.0 &&
@@ -3024,7 +3023,6 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
inv_scale = 1.f / scale;
glyph_align = gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_GLYPH_ALIGN);
hinting = gsk_font_get_hint_style (font) != CAIRO_HINT_STYLE_NONE;
for (i = 0; i < num_glyphs; i++)
@@ -3038,7 +3036,7 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
glyph_origin = GRAPHENE_POINT_INIT (offset.x + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
offset.y + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
if (hinting && glyph_align)
if (hinting)
{
/* Force glyph_origin.y to be device pixel aligned.
* The hinter expects that.
@@ -3048,7 +3046,7 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
glyph_origin.y = floor (glyph_origin.y * scale + .5) * inv_scale;
}
else if (glyph_align)
else
{
glyph_origin.x = floor (glyph_origin.x * scale * 4 + .5);
glyph_origin.y = floor (glyph_origin.y * scale * 4 + .5);
@@ -3057,12 +3055,6 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
glyph_origin.y = 0.25 * inv_scale * glyph_origin.y;
}
else
{
glyph_origin.x = floor (glyph_origin.x * scale + .5) * inv_scale;
glyph_origin.y = floor (glyph_origin.y * scale + .5) * inv_scale;
flags = 0;
}
image = gsk_gpu_device_lookup_glyph_image (device,
self->frame,
@@ -3121,7 +3113,6 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
guint32 tex_id;
GskGpuImage *last_image;
graphene_point_t offset;
gboolean glyph_align;
gboolean hinting;
if (gsk_text_node_has_color_glyphs (node))
@@ -3142,7 +3133,6 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
gsk_gpu_pattern_writer_append_rgba (self, gsk_text_node_get_color (node));
gsk_gpu_pattern_writer_append_uint (self, num_glyphs);
glyph_align = gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_GLYPH_ALIGN);
hinting = gsk_font_get_hint_style (font) != CAIRO_HINT_STYLE_NONE;
last_image = NULL;
@@ -3156,7 +3146,7 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
glyph_origin = GRAPHENE_POINT_INIT (offset.x + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
offset.y + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
if (hinting && glyph_align)
if (hinting)
{
/* Force glyph_origin.y to be device pixel aligned.
* The hinter expects that.
@@ -3166,7 +3156,7 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
glyph_origin.y = roundf (glyph_origin.y * scale) * inv_scale;
}
else if (glyph_align)
else
{
glyph_origin.x = roundf (glyph_origin.x * scale * 4);
glyph_origin.y = roundf (glyph_origin.y * scale * 4);
@@ -3175,12 +3165,6 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
glyph_origin.y = 0.25 * inv_scale * glyph_origin.y;
}
else
{
glyph_origin.x = roundf (glyph_origin.x * scale) * inv_scale;
glyph_origin.y = roundf (glyph_origin.y * scale) * inv_scale;
flags = 0;
}
image = gsk_gpu_device_lookup_glyph_image (device,
self->frame,

View File

@@ -30,7 +30,6 @@ static const GdkDebugKey gsk_gpu_optimization_keys[] = {
{ "blit", GSK_GPU_OPTIMIZE_BLIT, "Use shaders instead of vkCmdBlit()/glBlitFramebuffer()" },
{ "gradients", GSK_GPU_OPTIMIZE_GRADIENTS, "Don't supersample gradients" },
{ "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" },
{ "glyph-align", GSK_GPU_OPTIMIZE_GLYPH_ALIGN, "Never align glyphs to the subpixel grid" },
{ "gl-baseinstance", GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE, "Assume no ARB/EXT_base_instance support" },
};

View File

@@ -118,8 +118,7 @@ typedef enum {
GSK_GPU_OPTIMIZE_BLIT = 1 << 3,
GSK_GPU_OPTIMIZE_GRADIENTS = 1 << 4,
GSK_GPU_OPTIMIZE_MIPMAP = 1 << 5,
GSK_GPU_OPTIMIZE_GLYPH_ALIGN = 1 << 6,
/* These require hardware support */
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 7,
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 6,
} GskGpuOptimizations;