From fcd29473ff71b74bf541199293a966df2232fd63 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 16 Feb 2010 13:47:41 -0800 Subject: [PATCH] gl: Fix glyphs texture coordinates for ARB_texture_rectangle. Fixes most of the text testcases to match the ARB_texture_non_power_of_two results. --- src/cairo-gl-glyphs.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c index dbd24c534..8ea04ef68 100644 --- a/src/cairo-gl-glyphs.c +++ b/src/cairo-gl-glyphs.c @@ -125,12 +125,16 @@ _cairo_gl_glyph_cache_add_glyph (cairo_gl_context_t *ctx, glyph_private->cache = cache; /* compute tex coords */ - glyph_private->p1.x = node->x / (double) cache->width; - glyph_private->p1.y = node->y / (double) cache->height; - glyph_private->p2.x = - (node->x + glyph_surface->width) / (double) cache->width; - glyph_private->p2.y = - (node->y + glyph_surface->height) / (double) cache->height; + glyph_private->p1.x = node->x; + glyph_private->p1.y = node->y; + glyph_private->p2.x = node->x + glyph_surface->width; + glyph_private->p2.y = node->y + glyph_surface->height; + if (ctx->tex_target != GL_TEXTURE_RECTANGLE_EXT) { + glyph_private->p1.x /= cache->width; + glyph_private->p1.y /= cache->height; + glyph_private->p2.x /= cache->width; + glyph_private->p2.y /= cache->height; + } cairo_surface_destroy (&clone->base);