forked from AuroraMiddleware/gtk
Revert "Cache glyph textures in render nodes"
This reverts commit c5af463843
.
This commit is contained in:
parent
d3431f569c
commit
1038bc781a
@ -262,7 +262,13 @@ gsk_gl_glyph_cache_lookup_or_add (GskGLGlyphCache *cache,
|
||||
|
||||
if (value)
|
||||
{
|
||||
gsk_gl_glyph_cache_entry_validate (cache, value);
|
||||
if (value->atlas && !value->used)
|
||||
{
|
||||
gsk_gl_texture_atlas_mark_used (value->atlas, value->draw_width, value->draw_height);
|
||||
value->used = TRUE;
|
||||
}
|
||||
value->accessed = TRUE;
|
||||
|
||||
*cached_glyph_out = value;
|
||||
return;
|
||||
}
|
||||
@ -366,19 +372,4 @@ gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self,
|
||||
}
|
||||
|
||||
GSK_NOTE(GLYPH_CACHE, if (dropped > 0) g_message ("Dropped %d glyphs", dropped));
|
||||
|
||||
if (dropped > 0)
|
||||
self->atlas_timestamp++;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_glyph_cache_entry_validate (GskGLGlyphCache *cache,
|
||||
GskGLCachedGlyph *value)
|
||||
{
|
||||
value->accessed = TRUE;
|
||||
if (value->atlas && !value->used)
|
||||
{
|
||||
gsk_gl_texture_atlas_mark_used (value->atlas, value->draw_width, value->draw_height);
|
||||
value->used = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ typedef struct
|
||||
GskGLTextureAtlases *atlases;
|
||||
|
||||
int timestamp;
|
||||
int atlas_timestamp; /* incremented whenever an atlas is dropped */
|
||||
} GskGLGlyphCache;
|
||||
|
||||
struct _CacheKeyData
|
||||
@ -89,7 +88,5 @@ void gsk_gl_glyph_cache_lookup_or_add (GskGLGlyphCache
|
||||
GlyphCacheKey *lookup,
|
||||
GskGLDriver *driver,
|
||||
const GskGLCachedGlyph **cached_glyph_out);
|
||||
void gsk_gl_glyph_cache_entry_validate (GskGLGlyphCache *cache,
|
||||
GskGLCachedGlyph *entry);
|
||||
|
||||
#endif
|
||||
|
@ -535,39 +535,6 @@ render_fallback_node (GskGLRenderer *self,
|
||||
ops_draw (builder, offscreen_vertex_data);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int timestamp;
|
||||
GskGLCachedGlyph *glyphs[];
|
||||
} TextRenderData;
|
||||
|
||||
static inline TextRenderData *
|
||||
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);
|
||||
if (data)
|
||||
{
|
||||
if (data->timestamp < cache->atlas_timestamp)
|
||||
{
|
||||
memset (data->glyphs, 0, sizeof (gpointer) * num_glyphs);
|
||||
data->timestamp = cache->atlas_timestamp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
render_text_node (GskGLRenderer *self,
|
||||
GskRenderNode *node,
|
||||
@ -585,7 +552,6 @@ render_text_node (GskGLRenderer *self,
|
||||
float x = offset->x + builder->dx;
|
||||
float y = offset->y + builder->dy;
|
||||
GlyphCacheKey lookup;
|
||||
TextRenderData *render_data;
|
||||
|
||||
/* If the font has color glyphs, we don't need to recolor anything */
|
||||
if (!force_color && gsk_text_node_has_color_glyphs (node))
|
||||
@ -598,8 +564,6 @@ render_text_node (GskGLRenderer *self,
|
||||
ops_set_color (builder, color);
|
||||
}
|
||||
|
||||
render_data = ensure_render_data (node, self->glyph_cache);
|
||||
|
||||
memset (&lookup, 0, sizeof (CacheKeyData));
|
||||
lookup.data.font = (PangoFont *)font;
|
||||
lookup.data.scale = (guint) (text_scale * 1024);
|
||||
@ -621,19 +585,12 @@ render_text_node (GskGLRenderer *self,
|
||||
cx = (float)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
|
||||
cy = (float)(gi->geometry.y_offset) / PANGO_SCALE;
|
||||
|
||||
glyph = render_data->glyphs[i];
|
||||
if (!glyph)
|
||||
{
|
||||
glyph_cache_key_set_glyph_and_shift (&lookup, gi->glyph, x + cx, y + cy);
|
||||
glyph_cache_key_set_glyph_and_shift (&lookup, gi->glyph, x + cx, y + cy);
|
||||
|
||||
gsk_gl_glyph_cache_lookup_or_add (self->glyph_cache,
|
||||
&lookup,
|
||||
self->gl_driver,
|
||||
&glyph);
|
||||
render_data->glyphs[i] = (GskGLCachedGlyph *)glyph;
|
||||
}
|
||||
|
||||
gsk_gl_glyph_cache_entry_validate (self->glyph_cache, render_data->glyphs[i]);
|
||||
gsk_gl_glyph_cache_lookup_or_add (self->glyph_cache,
|
||||
&lookup,
|
||||
self->gl_driver,
|
||||
&glyph);
|
||||
|
||||
if (glyph->texture_id == 0)
|
||||
goto next;
|
||||
|
@ -3414,7 +3414,6 @@ struct _GskTextNode
|
||||
GdkRGBA color;
|
||||
graphene_point_t offset;
|
||||
|
||||
gpointer render_data;
|
||||
guint num_glyphs;
|
||||
PangoGlyphInfo glyphs[];
|
||||
};
|
||||
@ -3424,7 +3423,6 @@ gsk_text_node_finalize (GskRenderNode *node)
|
||||
{
|
||||
GskTextNode *self = (GskTextNode *) node;
|
||||
|
||||
g_free (self->render_data);
|
||||
g_object_unref (self->font);
|
||||
}
|
||||
|
||||
@ -3547,7 +3545,6 @@ gsk_text_node_new (PangoFont *font,
|
||||
self->has_color_glyphs = font_has_color_glyphs (font);
|
||||
self->color = *color;
|
||||
self->offset = *offset;
|
||||
self->render_data = NULL;
|
||||
self->num_glyphs = glyphs->num_glyphs;
|
||||
memcpy (self->glyphs, glyphs->glyphs, sizeof (PangoGlyphInfo) * glyphs->num_glyphs);
|
||||
|
||||
@ -3628,24 +3625,6 @@ gsk_text_node_get_offset (GskRenderNode *node)
|
||||
return &self->offset;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_text_node_set_render_data (GskRenderNode *node,
|
||||
gpointer data)
|
||||
{
|
||||
GskTextNode *self = (GskTextNode *) node;
|
||||
|
||||
self->render_data = data;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gsk_text_node_get_render_data (GskRenderNode *node)
|
||||
{
|
||||
GskTextNode *self = (GskTextNode *) node;
|
||||
|
||||
return self->render_data;
|
||||
}
|
||||
|
||||
|
||||
/*** GSK_BLUR_NODE ***/
|
||||
|
||||
typedef struct _GskBlurNode GskBlurNode;
|
||||
|
@ -46,10 +46,6 @@ void gsk_render_node_diff (GskRenderNode *nod
|
||||
void gsk_render_node_diff_impossible (GskRenderNode *node1,
|
||||
GskRenderNode *node2,
|
||||
cairo_region_t *region);
|
||||
void gsk_text_node_set_render_data (GskRenderNode *node,
|
||||
gpointer data);
|
||||
gpointer gsk_text_node_get_render_data (GskRenderNode *node);
|
||||
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user