forked from AuroraMiddleware/gtk
parent
7a73f43de3
commit
d3431f569c
@ -537,19 +537,18 @@ render_fallback_node (GskGLRenderer *self,
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int timestamp;
|
int timestamp;
|
||||||
int stored;
|
|
||||||
GskGLCachedGlyph *glyphs[];
|
GskGLCachedGlyph *glyphs[];
|
||||||
} TextRenderData;
|
} TextRenderData;
|
||||||
|
|
||||||
static inline TextRenderData *
|
static inline TextRenderData *
|
||||||
get_render_data (GskRenderNode *node,
|
ensure_render_data (GskRenderNode *node,
|
||||||
GskGLGlyphCache *cache)
|
GskGLGlyphCache *cache)
|
||||||
{
|
{
|
||||||
TextRenderData *data;
|
TextRenderData *data;
|
||||||
int num_glyphs;
|
int num_glyphs;
|
||||||
|
|
||||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
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)
|
||||||
{
|
{
|
||||||
if (data->timestamp < cache->atlas_timestamp)
|
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 = g_new0 (TextRenderData, sizeof (TextRenderData) + sizeof (gpointer) * num_glyphs);
|
||||||
data->timestamp = cache->atlas_timestamp;
|
data->timestamp = cache->atlas_timestamp;
|
||||||
|
|
||||||
|
gsk_text_node_set_render_data (node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 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
|
static inline void
|
||||||
render_text_node (GskGLRenderer *self,
|
render_text_node (GskGLRenderer *self,
|
||||||
GskRenderNode *node,
|
GskRenderNode *node,
|
||||||
@ -610,7 +598,7 @@ render_text_node (GskGLRenderer *self,
|
|||||||
ops_set_color (builder, color);
|
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));
|
memset (&lookup, 0, sizeof (CacheKeyData));
|
||||||
lookup.data.font = (PangoFont *)font;
|
lookup.data.font = (PangoFont *)font;
|
||||||
@ -675,8 +663,6 @@ render_text_node (GskGLRenderer *self,
|
|||||||
next:
|
next:
|
||||||
x_position += gi->geometry.width;
|
x_position += gi->geometry.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_render_data (node, self->glyph_cache, render_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -3414,9 +3414,7 @@ struct _GskTextNode
|
|||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
graphene_point_t offset;
|
graphene_point_t offset;
|
||||||
|
|
||||||
gpointer render_key;
|
|
||||||
gpointer render_data;
|
gpointer render_data;
|
||||||
|
|
||||||
guint num_glyphs;
|
guint num_glyphs;
|
||||||
PangoGlyphInfo glyphs[];
|
PangoGlyphInfo glyphs[];
|
||||||
};
|
};
|
||||||
@ -3549,7 +3547,6 @@ gsk_text_node_new (PangoFont *font,
|
|||||||
self->has_color_glyphs = font_has_color_glyphs (font);
|
self->has_color_glyphs = font_has_color_glyphs (font);
|
||||||
self->color = *color;
|
self->color = *color;
|
||||||
self->offset = *offset;
|
self->offset = *offset;
|
||||||
self->render_key = NULL;
|
|
||||||
self->render_data = NULL;
|
self->render_data = NULL;
|
||||||
self->num_glyphs = glyphs->num_glyphs;
|
self->num_glyphs = glyphs->num_glyphs;
|
||||||
memcpy (self->glyphs, glyphs->glyphs, sizeof (PangoGlyphInfo) * 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;
|
return &self->offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
gsk_text_node_set_render_data (GskRenderNode *node,
|
gsk_text_node_set_render_data (GskRenderNode *node,
|
||||||
gpointer key,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GskTextNode *self = (GskTextNode *) node;
|
GskTextNode *self = (GskTextNode *) node;
|
||||||
|
|
||||||
if (self->render_key != NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
self->render_key = key;
|
|
||||||
self->render_data = data;
|
self->render_data = data;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
gsk_text_node_get_render_data (GskRenderNode *node,
|
gsk_text_node_get_render_data (GskRenderNode *node)
|
||||||
gpointer key)
|
|
||||||
{
|
{
|
||||||
GskTextNode *self = (GskTextNode *) node;
|
GskTextNode *self = (GskTextNode *) node;
|
||||||
|
|
||||||
if (self->render_key != key)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return self->render_data;
|
return self->render_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +46,9 @@ void gsk_render_node_diff (GskRenderNode *nod
|
|||||||
void gsk_render_node_diff_impossible (GskRenderNode *node1,
|
void gsk_render_node_diff_impossible (GskRenderNode *node1,
|
||||||
GskRenderNode *node2,
|
GskRenderNode *node2,
|
||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
gboolean gsk_text_node_set_render_data (GskRenderNode *node,
|
void gsk_text_node_set_render_data (GskRenderNode *node,
|
||||||
gpointer key,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
gpointer gsk_text_node_get_render_data (GskRenderNode *node,
|
gpointer gsk_text_node_get_render_data (GskRenderNode *node);
|
||||||
gpointer key);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user