summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-18 20:12:44 +0200
committerBenjamin Otte <otte@redhat.com>2010-05-20 11:02:46 +0200
commit8adbf3aa19fd9fb8200973ecd72cdebfd9a5364d (patch)
tree928f1286ae9bae936a383e47367b7a7ad34834bc
parent915aa64ef077fe3b6094d0f1c8bd87ab5acc4868 (diff)
gl: Use _cairo_gl_surface_draw_image() when caching glyphs
-rw-r--r--src/cairo-gl-glyphs.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 7ccc7fd1..42527102 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -63,33 +63,8 @@ _cairo_gl_glyph_cache_add_glyph (cairo_gl_context_t *ctx,
cairo_gl_surface_t *cache_surface;
cairo_gl_glyph_private_t *glyph_private;
cairo_rtree_node_t *node = NULL;
- cairo_image_surface_t *clone = NULL;
cairo_status_t status;
int width, height;
- GLenum internal_format, format, type;
- cairo_bool_t has_alpha;
-
- if (! _cairo_gl_get_image_format_and_type (glyph_surface->pixman_format,
- &internal_format,
- &format,
- &type,
- &has_alpha))
- {
- cairo_bool_t is_supported;
-
- clone = _cairo_image_surface_coerce (glyph_surface);
- if (unlikely (clone->base.status))
- return clone->base.status;
-
- is_supported =
- _cairo_gl_get_image_format_and_type (clone->pixman_format,
- &internal_format,
- &format,
- &type,
- &has_alpha);
- assert (is_supported);
- glyph_surface = clone;
- }
width = glyph_surface->width;
if (width < GLYPH_CACHE_MIN_SIZE)
@@ -114,19 +89,15 @@ _cairo_gl_glyph_cache_add_glyph (cairo_gl_context_t *ctx,
cache_surface = (cairo_gl_surface_t *) cache->pattern.surface;
+ /* XXX: Make sure we use the mask texture. This should work automagically somehow */
glActiveTexture (GL_TEXTURE1);
- glBindTexture (ctx->tex_target, cache_surface->tex);
-
- glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei (GL_UNPACK_ROW_LENGTH,
- glyph_surface->stride /
- (PIXMAN_FORMAT_BPP (glyph_surface->pixman_format) / 8));
- glTexSubImage2D (ctx->tex_target, 0,
- node->x, node->y,
- glyph_surface->width, glyph_surface->height,
- format, type,
- glyph_surface->data);
- glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+ status = _cairo_gl_surface_draw_image (cache_surface,
+ glyph_surface,
+ 0, 0,
+ glyph_surface->width, glyph_surface->height,
+ node->x, node->y);
+ if (unlikely (status))
+ return status;
scaled_glyph->surface_private = node;
node->owner = &scaled_glyph->surface_private;
@@ -146,8 +117,6 @@ _cairo_gl_glyph_cache_add_glyph (cairo_gl_context_t *ctx,
glyph_private->p2.y /= cache_surface->height;
}
- cairo_surface_destroy (&clone->base);
-
return CAIRO_STATUS_SUCCESS;
}