mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
parent
7a73f43de3
commit
d3431f569c
@ -537,19 +537,18 @@ render_fallback_node (GskGLRenderer *self,
|
||||
|
||||
typedef struct {
|
||||
int timestamp;
|
||||
int stored;
|
||||
GskGLCachedGlyph *glyphs[];
|
||||
} TextRenderData;
|
||||
|
||||
static inline TextRenderData *
|
||||
get_render_data (GskRenderNode *node,
|
||||
GskGLGlyphCache *cache)
|
||||
ensure_render_data (GskRenderNode *node,
|
||||
GskGLGlyphCache *cache)
|
||||
{
|
||||
TextRenderData *data;
|
||||
int num_glyphs;
|
||||
|
||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
data = gsk_text_node_get_render_data (node, cache);
|
||||
data = gsk_text_node_get_render_data (node);
|
||||
if (data)
|
||||
{
|
||||
if (data->timestamp < cache->atlas_timestamp)
|
||||
@ -562,24 +561,13 @@ get_render_data (GskRenderNode *node,
|
||||
{
|
||||
data = g_new0 (TextRenderData, sizeof (TextRenderData) + sizeof (gpointer) * num_glyphs);
|
||||
data->timestamp = cache->atlas_timestamp;
|
||||
|
||||
gsk_text_node_set_render_data (node, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_render_data (GskRenderNode *node,
|
||||
GskGLGlyphCache *cache,
|
||||
TextRenderData *data)
|
||||
{
|
||||
if (!data->stored)
|
||||
{
|
||||
data->stored = 1;
|
||||
if (!gsk_text_node_set_render_data (node, cache, data))
|
||||
g_free (data);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
render_text_node (GskGLRenderer *self,
|
||||
GskRenderNode *node,
|
||||
@ -610,7 +598,7 @@ render_text_node (GskGLRenderer *self,
|
||||
ops_set_color (builder, color);
|
||||
}
|
||||
|
||||
render_data = get_render_data (node, self->glyph_cache);
|
||||
render_data = ensure_render_data (node, self->glyph_cache);
|
||||
|
||||
memset (&lookup, 0, sizeof (CacheKeyData));
|
||||
lookup.data.font = (PangoFont *)font;
|
||||
@ -675,8 +663,6 @@ render_text_node (GskGLRenderer *self,
|
||||
next:
|
||||
x_position += gi->geometry.width;
|
||||
}
|
||||
|
||||
set_render_data (node, self->glyph_cache, render_data);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -3414,9 +3414,7 @@ struct _GskTextNode
|
||||
GdkRGBA color;
|
||||
graphene_point_t offset;
|
||||
|
||||
gpointer render_key;
|
||||
gpointer render_data;
|
||||
|
||||
guint num_glyphs;
|
||||
PangoGlyphInfo glyphs[];
|
||||
};
|
||||
@ -3549,7 +3547,6 @@ gsk_text_node_new (PangoFont *font,
|
||||
self->has_color_glyphs = font_has_color_glyphs (font);
|
||||
self->color = *color;
|
||||
self->offset = *offset;
|
||||
self->render_key = NULL;
|
||||
self->render_data = NULL;
|
||||
self->num_glyphs = glyphs->num_glyphs;
|
||||
memcpy (self->glyphs, glyphs->glyphs, sizeof (PangoGlyphInfo) * glyphs->num_glyphs);
|
||||
@ -3631,31 +3628,20 @@ gsk_text_node_get_offset (GskRenderNode *node)
|
||||
return &self->offset;
|
||||
}
|
||||
|
||||
gboolean
|
||||
void
|
||||
gsk_text_node_set_render_data (GskRenderNode *node,
|
||||
gpointer key,
|
||||
gpointer data)
|
||||
{
|
||||
GskTextNode *self = (GskTextNode *) node;
|
||||
|
||||
if (self->render_key != NULL)
|
||||
return FALSE;
|
||||
|
||||
self->render_key = key;
|
||||
self->render_data = data;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gsk_text_node_get_render_data (GskRenderNode *node,
|
||||
gpointer key)
|
||||
gsk_text_node_get_render_data (GskRenderNode *node)
|
||||
{
|
||||
GskTextNode *self = (GskTextNode *) node;
|
||||
|
||||
if (self->render_key != key)
|
||||
return NULL;
|
||||
|
||||
return self->render_data;
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,9 @@ void gsk_render_node_diff (GskRenderNode *nod
|
||||
void gsk_render_node_diff_impossible (GskRenderNode *node1,
|
||||
GskRenderNode *node2,
|
||||
cairo_region_t *region);
|
||||
gboolean gsk_text_node_set_render_data (GskRenderNode *node,
|
||||
gpointer key,
|
||||
void gsk_text_node_set_render_data (GskRenderNode *node,
|
||||
gpointer data);
|
||||
gpointer gsk_text_node_get_render_data (GskRenderNode *node,
|
||||
gpointer key);
|
||||
gpointer gsk_text_node_get_render_data (GskRenderNode *node);
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user