[cairo] [PATCH 49/71] drm/intel: make struct _intel_glyph container of cairo_scaled_glyph_private_t

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:28 UTC 2017


Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/drm/cairo-drm-intel-private.h |  1 +
 src/drm/cairo-drm-intel.c         | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/drm/cairo-drm-intel-private.h b/src/drm/cairo-drm-intel-private.h
index e643e82b7..a35136712 100644
--- a/src/drm/cairo-drm-intel-private.h
+++ b/src/drm/cairo-drm-intel-private.h
@@ -159,6 +159,7 @@ typedef struct _intel_buffer_cache {
 
 typedef struct _intel_glyph {
     cairo_rtree_node_t node;
+    cairo_scaled_glyph_private_t base;
     cairo_scaled_glyph_t *glyph;
     intel_buffer_cache_t *cache;
     void **owner;
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index 609875a0a..8d9415ef9 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -873,12 +873,15 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
 	return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
     }
 
-    scaled_glyph->surface_private = node;
-
     glyph_private= (intel_glyph_t *) node;
     glyph_private->cache = cache;
     glyph_private->glyph = scaled_glyph;
 
+    _cairo_scaled_glyph_attach_private (scaled_glyph,
+					&glyph_private->base,
+					cache,
+					intel_scaled_glyph_fini);
+
     scaled_glyph->dev_private = glyph_private;
     scaled_glyph->dev_private_key = cache;
 
@@ -906,7 +909,9 @@ intel_scaled_glyph_fini (cairo_scaled_glyph_private_t *scaled_glyph_private,
 			 cairo_scaled_glyph_t         *scaled_glyph,
 			 cairo_scaled_font_t          *scaled_font)
 {
-    intel_glyph_t *priv = scaled_glyph->surface_private;
+    intel_glyph_t *priv = cairo_container_of(scaled_glyph_private,
+					     intel_glyph_t,
+					     base);
 
     /* XXX thread-safety? Probably ok due to the frozen scaled-font. */
     if (! priv->node.pinned)
-- 
2.11.0.rc0.7.gbe5a750



More information about the cairo mailing list