[gtk+/wip/matthiasc/text-node] Drop has-color from text node
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/text-node] Drop has-color from text node
- Date: Sun, 10 Sep 2017 14:10:03 +0000 (UTC)
commit 797042e6163446fd8f216a4ac1a1b7875f7e05c7
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 10 10:09:29 2017 -0400
Drop has-color from text node
The vulkan code now figures this out when it needs to.
gsk/gskrendernodeimpl.c | 31 -------------------------------
gsk/gskrendernodeprivate.h | 1 -
gsk/gskvulkanrenderpass.c | 21 ++++++++++++++++++++-
3 files changed, 20 insertions(+), 33 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 68f5b90..26ddb5d 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -26,8 +26,6 @@
#include "gskroundedrectprivate.h"
#include "gsktextureprivate.h"
-#include <cairo-ft.h>
-
static gboolean
check_variant_type (GVariant *variant,
const char *type_string,
@@ -3815,7 +3813,6 @@ struct _GskTextNode
PangoGlyphString *glyphs;
GdkRGBA color;
- gboolean has_color;
double x;
double y;
double ink_rect_y;
@@ -3923,23 +3920,6 @@ static const GskRenderNodeClass GSK_TEXT_NODE_CLASS = {
gsk_text_node_deserialize
};
-static gboolean
-font_has_color_glyphs (PangoFont *font)
-{
- cairo_scaled_font_t *scaled_font;
- gboolean has_color = FALSE;
-
- scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *)font);
- if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
- {
- FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
- has_color = (FT_HAS_COLOR (ft_face) != 0);
- cairo_ft_scaled_font_unlock_face (scaled_font);
- }
-
- return has_color;
-}
-
GskRenderNode *
gsk_text_node_new (PangoFont *font,
PangoGlyphString *glyphs,
@@ -3966,7 +3946,6 @@ gsk_text_node_new (PangoFont *font,
self->y = y;
self->ink_rect_y = ink_rect.y;
self->ink_rect_height = ink_rect.height;
- self->has_color = font_has_color_glyphs (font);
graphene_rect_init (&self->render_node.bounds,
x,
@@ -3977,16 +3956,6 @@ gsk_text_node_new (PangoFont *font,
return &self->render_node;
}
-gboolean
-gsk_text_node_get_has_color (GskRenderNode *node)
-{
- GskTextNode *self = (GskTextNode *) node;
-
- g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), FALSE);
-
- return self->has_color;
-}
-
const GdkRGBA *
gsk_text_node_get_color (GskRenderNode *node)
{
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index 008bdea..7639e7e 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -83,7 +83,6 @@ GskTexture *gsk_texture_node_get_texture (GskRenderNode *node);
PangoFont *gsk_text_node_get_font (GskRenderNode *node);
PangoGlyphString *gsk_text_node_get_glyphs (GskRenderNode *node);
-gboolean gsk_text_node_get_has_color (GskRenderNode *node);
const GdkRGBA *gsk_text_node_get_color (GskRenderNode *node);
const GdkRGBA *gsk_color_node_peek_color (GskRenderNode *node);
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 70e1f06..364e6c8 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -20,6 +20,8 @@
#include "gskvulkanpushconstantsprivate.h"
#include "gskvulkanrendererprivate.h"
+#include <cairo-ft.h>
+
typedef union _GskVulkanOp GskVulkanOp;
typedef struct _GskVulkanOpRender GskVulkanOpRender;
typedef struct _GskVulkanOpPushConstants GskVulkanOpPushConstants;
@@ -99,6 +101,23 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
g_slice_free (GskVulkanRenderPass, self);
}
+static gboolean
+font_has_color_glyphs (PangoFont *font)
+{
+ cairo_scaled_font_t *scaled_font;
+ gboolean has_color = FALSE;
+
+ scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *)font);
+ if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
+ {
+ FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+ has_color = (FT_HAS_COLOR (ft_face) != 0);
+ cairo_ft_scaled_font_unlock_face (scaled_font);
+ }
+
+ return has_color;
+}
+
#define FALLBACK(...) G_STMT_START { \
GSK_NOTE (FALLBACK, g_print (__VA_ARGS__)); \
goto fallback; \
@@ -177,7 +196,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
return;
case GSK_TEXT_NODE:
- if (gsk_text_node_get_has_color (node))
+ if (font_has_color_glyphs (gsk_text_node_get_font (node)))
{
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_TEXT;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]