[cairo-commit] 8 commits - src/cairo-gl-glyphs.c src/cairo-gl-private.h src/cairo-gl-shaders.c src/cairo-gl-surface.c src/Makefile.sources

Eric Anholt anholt at kemper.freedesktop.org
Thu Jan 14 10:28:43 PST 2010


 src/Makefile.sources   |    2 
 src/cairo-gl-glyphs.c  |    9 -
 src/cairo-gl-private.h |    7 +
 src/cairo-gl-shaders.c |  117 ++++++++++++++++++++
 src/cairo-gl-surface.c |  277 +++++++++++++++++++++++--------------------------
 5 files changed, 260 insertions(+), 152 deletions(-)

New commits:
commit e26e2c8cc41b4e60462eacbd87894dc82beca883
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 14 10:05:02 2010 -0800

    [gl] Fix the color bits of CAIRO_CONTENT_ALPHA surface patterns to be 0.
    
    Fixes surface-pattern-operator and alpha-similar.

diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 5a32dba..a3f2dc9 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -113,7 +113,6 @@ typedef struct cairo_gl_composite_operand {
 	    GLuint tex;
 	    cairo_gl_surface_t *surface;
 	    cairo_surface_attributes_t attributes;
-	    cairo_bool_t has_alpha;
 	} texture;
 	struct {
 	    GLfloat color[4];
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 1ba46a9..7110f0d 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -954,15 +954,6 @@ _cairo_gl_pattern_texture_setup (cairo_gl_composite_operand_t *operand,
 
     operand->operand.texture.surface = surface;
     operand->operand.texture.tex = surface->tex;
-    switch (surface->base.content) {
-    case CAIRO_CONTENT_ALPHA:
-    case CAIRO_CONTENT_COLOR_ALPHA:
-	operand->operand.texture.has_alpha = TRUE;
-	break;
-    case CAIRO_CONTENT_COLOR:
-	operand->operand.texture.has_alpha = FALSE;
-	break;
-    }
 
     /* Translate the matrix from
      * (unnormalized src -> unnormalized src) to
@@ -1142,13 +1133,22 @@ _cairo_gl_set_src_operand (cairo_gl_context_t *ctx,
 	glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
 	glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
 
-	glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
+	/* Force the src color to 0 if the surface should be alpha-only.
+	 * We may have a teximage with color bits if the implementation doesn't
+	 * support GL_ALPHA FBOs.
+	 */
+	if (setup->src.operand.texture.surface->base.content !=
+	    CAIRO_CONTENT_ALPHA)
+	    glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
+	else
+	    glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_CONSTANT);
 	/* Wire the src alpha to 1 if the surface doesn't have it.
 	 * We may have a teximage with alpha bits even though we didn't ask
 	 * for it and we don't pay attention to setting alpha to 1 in a dest
 	 * that has inadvertent alpha.
 	 */
-	if (setup->src.operand.texture.has_alpha)
+	if (setup->src.operand.texture.surface->base.content !=
+	    CAIRO_CONTENT_COLOR)
 	    glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
 	else
 	    glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_CONSTANT);
commit 520945603cdbacb90b3067f24a37b6dbd2ea6808
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 14 10:00:37 2010 -0800

    [gl] Remove the special-casing of acquiring a pattern surface.
    
    _cairo_pattern_acquire_surface() should do fine at it, and matches
    what cairo-drm-i915 does.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 9170f06..1ba46a9 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -921,121 +921,6 @@ _cairo_gl_get_traps_pattern (cairo_gl_surface_t *dst,
     return CAIRO_STATUS_SUCCESS;
 }
 
-static cairo_status_t
-_cairo_gl_pattern_surface_texture_setup (cairo_gl_composite_operand_t *operand,
-				         const cairo_surface_pattern_t *src,
-					 cairo_gl_surface_t *dst,
-					 int src_x, int src_y,
-					 int dst_x, int dst_y)
-{
-    cairo_surface_t *source = src->surface;
-    cairo_gl_surface_t *gl_surface;
-    cairo_status_t status;
-    cairo_matrix_t m;
-    cairo_surface_attributes_t *attributes;
-
-    if (source->backend != &_cairo_gl_surface_backend) {
-	gl_surface = (cairo_gl_surface_t *)
-	    _cairo_surface_has_snapshot (source,
-		                         &_cairo_gl_surface_backend,
-		                         source->content);
-	if (gl_surface == NULL) {
-	    cairo_image_surface_t *image;
-	    void *image_extra;
-
-	    status = _cairo_surface_acquire_source_image (source,
-		                                          &image, &image_extra);
-	    if (unlikely (status))
-		return status;
-
-	    gl_surface = (cairo_gl_surface_t *)
-		_cairo_gl_surface_create_similar (&dst->base,
-			                          image->base.content,
-						  image->width, image->height);
-	    if (gl_surface == NULL) {
-		_cairo_surface_release_source_image (source,
-			                             image, image_extra);
-		return CAIRO_INT_STATUS_UNSUPPORTED;
-	    }
-	    if (unlikely (gl_surface->base.status)) {
-		_cairo_surface_release_source_image (source,
-			                             image, image_extra);
-		return gl_surface->base.status;
-	    }
-
-	    status = _cairo_gl_surface_draw_image (gl_surface, image,
-		                                   0, 0,
-						   image->width, image->height,
-						   0, 0);
-	    _cairo_surface_release_source_image (source, image, image_extra);
-	    if (unlikely (status)) {
-		cairo_surface_destroy (&gl_surface->base);
-		return status;
-	    }
-
-	    status = _cairo_surface_attach_snapshot (source,
-		                                     &gl_surface->base,
-						     cairo_surface_destroy);
-	    if (unlikely (status)) {
-		cairo_surface_destroy (&gl_surface->base);
-		return status;
-	    }
-
-	    /* XXX consider placing a bound on snapshot caches */
-	}
-    } else {
-	gl_surface = (cairo_gl_surface_t *) source;
-    }
-
-    operand->operand.texture.surface = NULL;
-    operand->operand.texture.tex = gl_surface->tex;
-    switch (gl_surface->base.content) {
-	case CAIRO_CONTENT_ALPHA:
-	case CAIRO_CONTENT_COLOR_ALPHA:
-	    operand->operand.texture.has_alpha = TRUE;
-	    break;
-	case CAIRO_CONTENT_COLOR:
-	    operand->operand.texture.has_alpha = FALSE;
-	    break;
-    }
-
-    attributes = &operand->operand.texture.attributes;
-
-    operand->type = OPERAND_TEXTURE;
-    attributes->matrix = src->base.matrix;
-    attributes->has_component_alpha = src->base.has_component_alpha;
-    attributes->extend = src->base.extend;
-    attributes->filter = src->base.filter;
-    /* Demote the filter if we're doing a 1:1 mapping of pixels. */
-    if ((attributes->filter == CAIRO_FILTER_GOOD ||
-	 attributes->filter == CAIRO_FILTER_BEST ||
-	 attributes->filter == CAIRO_FILTER_BILINEAR) &&
-	_cairo_matrix_is_pixel_exact (&attributes->matrix))
-    {
-	attributes->filter = CAIRO_FILTER_NEAREST;
-    }
-
-    attributes->x_offset = 0;
-    attributes->y_offset = 0;
-
-    /* Set up translation matrix for
-     * (unnormalized dst -> unnormalized src)
-     */
-    cairo_matrix_init_translate (&m, src_x - dst_x, src_y - dst_y);
-    cairo_matrix_multiply (&attributes->matrix, &m, &attributes->matrix);
-
-    /* Translate the matrix from
-     * (unnormalized src -> unnormalized src) to
-     * (unnormalized dst -> normalized src)
-     */
-    cairo_matrix_init_scale (&m,
-			     1.0 / gl_surface->width,
-			     1.0 / gl_surface->height);
-    cairo_matrix_multiply (&attributes->matrix, &attributes->matrix, &m);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
 /**
  * Like cairo_pattern_acquire_surface(), but returns a matrix that transforms
  * from dest to src coords.
@@ -1055,18 +940,6 @@ _cairo_gl_pattern_texture_setup (cairo_gl_composite_operand_t *operand,
 
     attributes = &operand->operand.texture.attributes;
 
-    /* First, try to just upload it to a texture if it's a surface. */
-    if (src->type == CAIRO_PATTERN_TYPE_SURFACE) {
-	status =
-	    _cairo_gl_pattern_surface_texture_setup (operand,
-		                                     (cairo_surface_pattern_t *) src,
-						     dst,
-						     src_x, src_y,
-						     dst_x, dst_y);
-	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-	    return status;
-    }
-
     status = _cairo_pattern_acquire_surface (src, &dst->base,
 					     src_x, src_y,
 					     width, height,
commit dbf9faf8232e7bf279377b5f3fc08ed210ca4e51
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jan 13 10:33:32 2010 -0800

    [gl] Use GLSL for fill_rectangles when available.
    
    Ultimately, we want all of our paths to use shaders when they are
    exposed -- it brings us closer to GL 3.0 compatibility and it should
    reduce the work that GL drivers have to do per operation to compute
    the required hardware state.

diff --git a/src/Makefile.sources b/src/Makefile.sources
index 1e04ed2..71d0abd 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -279,7 +279,7 @@ cairo_beos_headers = cairo-beos.h
 
 cairo_gl_headers = cairo-gl.h
 cairo_gl_private = cairo-gl-private.h
-cairo_gl_sources = cairo-gl-surface.c cairo-gl-glyphs.c
+cairo_gl_sources = cairo-gl-surface.c cairo-gl-glyphs.c cairo-gl-shaders.c
 cairo_glx_sources += cairo-glx-context.c
 cairo_eagle_sources += cairo-eagle-context.c
 
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 79145cf..5a32dba 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -85,6 +85,8 @@ struct _cairo_gl_context {
 
     cairo_mutex_t mutex; /* needed? */
     GLuint dummy_tex;
+    GLint fill_rectangles_shader;
+    GLint fill_rectangles_color_uniform;
     GLint max_framebuffer_size;
     GLint max_texture_size;
 
@@ -202,6 +204,10 @@ _cairo_gl_surface_show_glyphs (void			*abstract_dst,
 cairo_private void
 _cairo_gl_glyph_cache_fini (cairo_gl_glyph_cache_t *cache);
 
+cairo_private cairo_status_t
+_cairo_gl_load_glsl (GLint *shader,
+		     const char *vs_source, const char *fs_source);
+
 static inline int
 _cairo_gl_y_flip (cairo_gl_surface_t *surface, int y)
 {
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
new file mode 100644
index 0000000..f06991e
--- /dev/null
+++ b/src/cairo-gl-shaders.c
@@ -0,0 +1,117 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2010 Eric Anholt
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Eric Anholt.
+ */
+
+#include "cairoint.h"
+#include "cairo-gl-private.h"
+
+static GLint
+_cairo_gl_compile_glsl(GLenum type, GLint *shader_out, const char *source)
+{
+    GLint ok;
+    GLint shader;
+
+    shader = glCreateShaderObjectARB (type);
+    glShaderSourceARB (shader, 1, (const GLchar **)&source, NULL);
+    glCompileShaderARB (shader);
+    glGetObjectParameterivARB (shader, GL_OBJECT_COMPILE_STATUS_ARB, &ok);
+    if (!ok) {
+	GLchar *info;
+	GLint size;
+
+	glGetObjectParameterivARB (shader, GL_OBJECT_INFO_LOG_LENGTH_ARB,
+				   &size);
+	info = malloc (size);
+
+	if (info)
+	    glGetInfoLogARB (shader, size, NULL, info);
+	fprintf (stderr, "Failed to compile %s: %s\n",
+		 type == GL_FRAGMENT_SHADER ? "FS" : "VS",
+		 info);
+	fprintf (stderr, "Shader source:\n%s", source);
+	fprintf (stderr, "GLSL compile failure\n");
+
+	glDeleteObjectARB (shader);
+
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
+
+    *shader_out = shader;
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gl_load_glsl (GLint *shader_out,
+		     const char *vs_source, const char *fs_source)
+{
+    GLint ok;
+    GLint shader, vs, fs;
+    cairo_status_t status;
+
+    shader = glCreateProgramObjectARB ();
+
+    status = _cairo_gl_compile_glsl (GL_VERTEX_SHADER_ARB, &vs, vs_source);
+    if (_cairo_status_is_error (status))
+	goto fail;
+    status = _cairo_gl_compile_glsl (GL_FRAGMENT_SHADER_ARB, &fs, fs_source);
+    if (_cairo_status_is_error (status))
+	goto fail;
+
+    glAttachObjectARB (shader, vs);
+    glAttachObjectARB (shader, fs);
+    glLinkProgram (shader);
+    glGetObjectParameterivARB (shader, GL_OBJECT_LINK_STATUS_ARB, &ok);
+    if (!ok) {
+	GLchar *info;
+	GLint size;
+
+	glGetObjectParameterivARB (shader, GL_OBJECT_INFO_LOG_LENGTH_ARB,
+				   &size);
+	info = malloc (size);
+
+	if (info)
+	    glGetInfoLogARB (shader, size, NULL, info);
+	fprintf (stderr, "Failed to link: %s\n", info);
+	free (info);
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
+
+    *shader_out = shader;
+
+    return CAIRO_STATUS_SUCCESS;
+
+fail:
+    glDeleteObjectARB (shader);
+    return status;
+}
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index af658cb..9170f06 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1549,11 +1549,11 @@ _cairo_gl_surface_composite_trapezoids (cairo_operator_t op,
 }
 
 static cairo_int_status_t
-_cairo_gl_surface_fill_rectangles (void			   *abstract_surface,
-				   cairo_operator_t	    op,
-				   const cairo_color_t     *color,
-				   cairo_rectangle_int_t   *rects,
-				   int			    num_rects)
+_cairo_gl_surface_fill_rectangles_fixed (void			 *abstract_surface,
+					 cairo_operator_t	  op,
+					 const cairo_color_t     *color,
+					 cairo_rectangle_int_t   *rects,
+					 int			  num_rects)
 {
 #define N_STACK_RECTS 4
     cairo_gl_surface_t *surface = abstract_surface;
@@ -1632,6 +1632,121 @@ _cairo_gl_surface_fill_rectangles (void			   *abstract_surface,
 #undef N_STACK_RECTS
 }
 
+static cairo_int_status_t
+_cairo_gl_surface_fill_rectangles_glsl (void                  *abstract_surface,
+					cairo_operator_t       op,
+					const cairo_color_t   *color,
+					cairo_rectangle_int_t *rects,
+					int                    num_rects)
+{
+#define N_STACK_RECTS 4
+    cairo_gl_surface_t *surface = abstract_surface;
+    GLfloat vertices_stack[N_STACK_RECTS*4*2];
+    GLfloat gl_color[4];
+    cairo_gl_context_t *ctx;
+    int i;
+    GLfloat *vertices;
+    static const char *fill_vs_source =
+	"void main()\n"
+	"{\n"
+	"	gl_Position = ftransform();\n"
+	"}\n";
+    static const char *fill_fs_source =
+	"uniform vec4 color;\n"
+	"void main()\n"
+	"{\n"
+	"	gl_FragColor = color;\n"
+	"}\n";
+    cairo_status_t status;
+
+    if (! _cairo_gl_operator_is_supported (op))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    ctx = _cairo_gl_context_acquire (surface->ctx);
+
+    if (ctx->fill_rectangles_shader == 0) {
+	status = _cairo_gl_load_glsl (&ctx->fill_rectangles_shader,
+				      fill_vs_source, fill_fs_source);
+	if (_cairo_status_is_error (status))
+	    return status;
+
+	ctx->fill_rectangles_color_uniform =
+	    glGetUniformLocationARB (ctx->fill_rectangles_shader, "color");
+    }
+
+    if (num_rects > N_STACK_RECTS) {
+	vertices = _cairo_malloc_ab (num_rects, sizeof (GLfloat) * 4 * 2);
+	if (!vertices) {
+	    _cairo_gl_context_release (ctx);
+	    free (vertices);
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+	}
+    } else {
+	vertices = vertices_stack;
+    }
+
+    glUseProgramObjectARB (ctx->fill_rectangles_shader);
+
+    _cairo_gl_set_destination (surface);
+    _cairo_gl_set_operator (surface, op);
+
+    gl_color[0] = color->red * color->alpha;
+    gl_color[1] = color->green * color->alpha;
+    gl_color[2] = color->blue * color->alpha;
+    gl_color[3] = color->alpha;
+    glUniform4fvARB (ctx->fill_rectangles_color_uniform, 1, gl_color);
+
+    for (i = 0; i < num_rects; i++) {
+	vertices[i * 8 + 0] = rects[i].x;
+	vertices[i * 8 + 1] = rects[i].y;
+	vertices[i * 8 + 2] = rects[i].x + rects[i].width;
+	vertices[i * 8 + 3] = rects[i].y;
+	vertices[i * 8 + 4] = rects[i].x + rects[i].width;
+	vertices[i * 8 + 5] = rects[i].y + rects[i].height;
+	vertices[i * 8 + 6] = rects[i].x;
+	vertices[i * 8 + 7] = rects[i].y + rects[i].height;
+    }
+
+    glVertexPointer (2, GL_FLOAT, sizeof (GLfloat)*2, vertices);
+    glEnableClientState (GL_VERTEX_ARRAY);
+
+    glDrawArrays (GL_QUADS, 0, 4 * num_rects);
+
+    glDisableClientState (GL_VERTEX_ARRAY);
+    glDisable (GL_BLEND);
+    glUseProgramObjectARB (0);
+
+    _cairo_gl_context_release (ctx);
+    if (vertices != vertices_stack)
+	free (vertices);
+
+    return CAIRO_STATUS_SUCCESS;
+#undef N_STACK_RECTS
+}
+
+
+static cairo_int_status_t
+_cairo_gl_surface_fill_rectangles (void			   *abstract_surface,
+				   cairo_operator_t	    op,
+				   const cairo_color_t     *color,
+				   cairo_rectangle_int_t   *rects,
+				   int			    num_rects)
+{
+    if (GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader) {
+	return _cairo_gl_surface_fill_rectangles_glsl(abstract_surface,
+						      op,
+						      color,
+						      rects,
+						      num_rects);
+    } else {
+	return _cairo_gl_surface_fill_rectangles_fixed(abstract_surface,
+						       op,
+						       color,
+						       rects,
+						       num_rects);
+    }
+}
+
 typedef struct _cairo_gl_surface_span_renderer {
     cairo_span_renderer_t base;
 
commit 57341cf5ac4d16222da27856e3a1092a473597e8
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jan 13 14:18:06 2010 -0800

    [gl] Use ADD instead of SOURCE when making a mask for overlapping glyphs.
    
    The whole point of making the mask was to avoid overwriting one glyph
    with the data from another.  Whoops.
    
    Fixes ft-show-glyphs-positioning, text-rotate, overlapping-glyphs,
    clip-text.

diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 23acf2b..fb3bdd4 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -568,7 +568,7 @@ _cairo_gl_surface_show_glyphs_via_mask (cairo_gl_surface_t	*dst,
 
     _cairo_pattern_init_solid (&solid, CAIRO_COLOR_WHITE, CAIRO_CONTENT_COLOR_ALPHA);
     status = _render_glyphs ((cairo_gl_surface_t *) mask, 0, 0,
-	                     CAIRO_OPERATOR_SOURCE, &solid.base,
+	                     CAIRO_OPERATOR_ADD, &solid.base,
 	                     glyphs, num_glyphs, glyph_extents,
 			     scaled_font, &has_component_alpha,
 			     NULL, remaining_glyphs);
commit 6e0a63102e7e2d3fa3d5c993f2b94a2d6e40bdd8
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jan 13 14:06:23 2010 -0800

    [gl] Clear the current_target cache when binding a framebuffer in creation.
    
    Failing to do so meant that we might not re-bind the framebuffer to
    the correct one if we didn't follow up surface creation with drawing
    to it.
    
    Fixes many testcases.  Thanks to T. Zachary Laine for tracking down
    that the current_target was the source of these issues.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 9a3faf3..af658cb 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -503,6 +503,7 @@ _cairo_gl_surface_create_scratch (cairo_gl_context_t   *ctx,
 			       GL_TEXTURE_2D,
 			       surface->tex,
 			       0);
+    ctx->current_target = NULL;
 
     while ((err = glGetError ())) {
 	fprintf (stderr, "GL error in surface create: 0x%08x\n", err);
commit ad0f4bee19b214b96fb07a45d1f059b362afee0f
Author: T. Zachary Laine <whatwasthataddress at gmail.com>
Date:   Thu Jan 7 17:24:31 2010 -0600

    [gl] Clear the is_clear flag on the temporary glyph mask we create.
    
    Normally is_clear is cleared by the caller of one of the 5 basic
    entrypoints, but in this temporary surface usage nobody else can do it
    for us.
    
    Fixes ft-show-glyphs-table, user-font-rescale, and select-font-face.

diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 47a8b5d..23acf2b 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -575,6 +575,7 @@ _cairo_gl_surface_show_glyphs_via_mask (cairo_gl_surface_t	*dst,
     if (likely (status == CAIRO_STATUS_SUCCESS)) {
 	cairo_surface_pattern_t mask_pattern;
 
+        mask->is_clear = FALSE;
 	_cairo_pattern_init_for_surface (&mask_pattern, mask);
 	mask_pattern.base.has_component_alpha = has_component_alpha;
 	cairo_matrix_init_translate (&mask_pattern.base.matrix,
commit 384e50d858e9eec670f764c758fb3aa09b56caed
Author: T. Zachary Laine <whatwasthataddress at gmail.com>
Date:   Wed Jan 13 15:06:24 2010 -0600

    [gl] Removed repeated lines of source
    
    The two removed lines are redundant with code a few lines above them.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 07b6d4d..9a3faf3 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1001,8 +1001,6 @@ _cairo_gl_pattern_surface_texture_setup (cairo_gl_composite_operand_t *operand,
     attributes = &operand->operand.texture.attributes;
 
     operand->type = OPERAND_TEXTURE;
-    operand->operand.texture.tex = gl_surface->tex;
-    operand->operand.texture.surface = NULL;
     attributes->matrix = src->base.matrix;
     attributes->has_component_alpha = src->base.has_component_alpha;
     attributes->extend = src->base.extend;
commit 515ccb63a67c88ddb2bc5adfd018cae55bc93185
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jan 11 16:04:21 2010 -0800

    [gl] Fix the glyph cache full flush to really try again.
    
    Previously, the initial error handling would dump through to software
    fallback instead of retrying in the following code.

diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 4370fdb..47a8b5d 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -478,17 +478,15 @@ _render_glyphs (cairo_gl_surface_t	*dst,
 
 	if (scaled_glyph->surface_private == NULL) {
 	    status = _cairo_gl_glyph_cache_add_glyph (cache, scaled_glyph);
-	    if (unlikely (_cairo_status_is_error (status)))
-		goto FINISH;
 
 	    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 		/* Cache is full, so flush existing prims and try again. */
 		_cairo_gl_flush_glyphs (ctx, &setup);
 		_cairo_gl_glyph_cache_unlock (cache);
+		status = _cairo_gl_glyph_cache_add_glyph (cache, scaled_glyph);
 	    }
 
-	    status = _cairo_gl_glyph_cache_add_glyph (cache, scaled_glyph);
-	    if (unlikely (status))
+	    if (unlikely (_cairo_status_is_error (status)))
 		goto FINISH;
 	}
 


More information about the cairo-commit mailing list