[gtk/half-float: 8/11] ngl: Use a constant for (fp16)-1
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/half-float: 8/11] ngl: Use a constant for (fp16)-1
- Date: Thu, 8 Apr 2021 01:32:43 +0000 (UTC)
commit 7fe7b7ac7d260fedd7bb4485047be6cf2a738d83
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 6 23:11:27 2021 -0400
ngl: Use a constant for (fp16)-1
No need to convert that again for every glyph.
gsk/ngl/fp16private.h | 2 ++
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]