diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-04-06 23:11:27 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-04-07 21:30:43 -0400 |
commit | 7fe7b7ac7d260fedd7bb4485047be6cf2a738d83 (patch) | |
tree | dc8f3c2a32b42734232b9d76f941a209aa57d54c | |
parent | ae7f52d3019957d4876d0e802446020368953ca9 (diff) | |
download | gtk+-7fe7b7ac7d260fedd7bb4485047be6cf2a738d83.tar.gz |
ngl: Use a constant for (fp16)-1
No need to convert that again for every glyph.
-rw-r--r-- | gsk/ngl/fp16private.h | 2 | ||||
-rw-r--r-- | gsk/ngl/gsknglrenderjob.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gsk/ngl/fp16private.h b/gsk/ngl/fp16private.h index b285bf450c..3f74605288 100644 --- a/gsk/ngl/fp16private.h +++ b/gsk/ngl/fp16private.h @@ -30,6 +30,8 @@ G_BEGIN_DECLS +#define FP16_MINUS_ONE ((guint16)48128) + #ifdef GRAPHENE_USE_SSE static inline void diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c index 3f03148a84..56832efeea 100644 --- a/gsk/ngl/gsknglrenderjob.c +++ b/gsk/ngl/gsknglrenderjob.c @@ -2714,7 +2714,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job, guint last_texture = 0; GskNglDrawVertex *vertices; guint used = 0; - guint16 c[4]; + guint16 c[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE }; const PangoGlyphInfo *gi; guint i; int yshift; @@ -2726,9 +2726,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job, /* If the font has color glyphs, we don't need to recolor anything. * We tell the shader by setting the color to vec4(-1). */ - if (!force_color && gsk_text_node_has_color_glyphs (node)) - rgba_to_half (&(GdkRGBA){ -1.f, -1.f, -1.f, -1.f }, c); - else + if (force_color || !gsk_text_node_has_color_glyphs (node)) rgba_to_half (color, c); lookup.font = (PangoFont *)font; |