[gtk] glglyphcache: Remove surface member from dirty glyph
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] glglyphcache: Remove surface member from dirty glyph
- Date: Sun, 10 Feb 2019 09:37:57 +0000 (UTC)
commit ea554580c7c099081e577a97e793ac6f16c014b6
Author: Timm Bäder <tbaeder redhat com>
Date: Fri Feb 8 11:01:39 2019 +0100
glglyphcache: Remove surface member from dirty glyph
We don't use it after we've rendered to it, just its size and data.
gsk/gl/gskglglyphcache.c | 20 +++++++-------------
gsk/gl/gskglglyphcacheprivate.h | 1 -
2 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index dc8d5149a9..655da906ab 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -29,7 +29,6 @@ static gboolean glyph_cache_equal (gconstpointer v1,
gconstpointer v2);
static void glyph_cache_key_free (gpointer v);
static void glyph_cache_value_free (gpointer v);
-static void dirty_glyph_free (gpointer v);
static GskGLGlyphAtlas *
create_atlas (GskGLGlyphCache *cache)
@@ -129,15 +128,6 @@ glyph_cache_value_free (gpointer v)
g_free (v);
}
-static void
-dirty_glyph_free (gpointer v)
-{
- DirtyGlyph *glyph = v;
-
- if (glyph->surface)
- cairo_surface_destroy (glyph->surface);
-}
-
static void
add_to_cache (GskGLGlyphCache *cache,
GlyphCacheKey *key,
@@ -249,14 +239,17 @@ render_glyph (const GskGLGlyphAtlas *atlas,
pango_cairo_show_glyph_string (cr, key->font, &glyph_string);
cairo_destroy (cr);
- glyph->surface = surface;
+ cairo_surface_flush (surface);
- region->data = cairo_image_surface_get_data (surface);
region->width = cairo_image_surface_get_width (surface);
region->height = cairo_image_surface_get_height (surface);
region->stride = cairo_image_surface_get_stride (surface);
+ region->data = g_memdup (cairo_image_surface_get_data (surface),
+ region->stride * region->height * sizeof (guchar));
region->x = (gsize)(value->tx * atlas->width);
region->y = (gsize)(value->ty * atlas->height);
+
+ cairo_surface_destroy (surface);
}
static void
@@ -271,7 +264,8 @@ upload_dirty_glyph (GskGLGlyphCache *self,
gsk_gl_image_upload_regions (atlas->image, self->gl_driver, 1, ®ion);
- dirty_glyph_free (&atlas->pending_glyph);
+ g_free (region.data);
+
atlas->pending_glyph.key = NULL;
atlas->pending_glyph.value = NULL;
}
diff --git a/gsk/gl/gskglglyphcacheprivate.h b/gsk/gl/gskglglyphcacheprivate.h
index d93bbdcfc6..00c3dab95c 100644
--- a/gsk/gl/gskglglyphcacheprivate.h
+++ b/gsk/gl/gskglglyphcacheprivate.h
@@ -32,7 +32,6 @@ struct _DirtyGlyph
{
GlyphCacheKey *key;
GskGLCachedGlyph *value;
- cairo_surface_t *surface;
};
typedef struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]