[cairo-commit] 3 commits - src/cairo-gl-composite.c src/cairo-gl-private.h src/cairo-gl-shaders.c src/cairo-gl-surface.c

Benjamin Otte company at kemper.freedesktop.org
Thu May 20 13:12:27 PDT 2010


 src/cairo-gl-composite.c |   29 ++++++++++++++++-------------
 src/cairo-gl-private.h   |    2 +-
 src/cairo-gl-shaders.c   |    4 +++-
 src/cairo-gl-surface.c   |    6 ++----
 4 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit d7a564d8eed32b4417fdb4c8c5d91467e4ae1019
Author: Benjamin Otte <otte at redhat.com>
Date:   Thu May 20 22:10:06 2010 +0200

    gl: Don't set is_clear
    
    1) It's wrong.
    2) The core functions set the flag correctly already.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 671a385..96b10e9 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -338,8 +338,6 @@ _cairo_gl_surface_clear (cairo_gl_surface_t  *surface,
     glClear (GL_COLOR_BUFFER_BIT);
     _cairo_gl_context_release (ctx);
 
-    surface->base.is_clear = TRUE;
-
     return CAIRO_STATUS_SUCCESS;
 }
 
commit f9cf07b126293d00df085d4fbfa337e1132e0258
Author: Benjamin Otte <otte at redhat.com>
Date:   Thu May 20 16:08:38 2010 +0200

    gl: Fix coverage passing for spans not being endian safe.

diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index d75ce85..90863ae 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -1171,7 +1171,7 @@ _cairo_gl_operand_emit (cairo_gl_operand_t *operand,
                         GLfloat ** vb,
                         GLfloat x,
                         GLfloat y,
-                        uint32_t color)
+                        uint8_t alpha)
 {
     switch (operand->type) {
     default:
@@ -1186,10 +1186,13 @@ _cairo_gl_operand_emit (cairo_gl_operand_t *operand,
         {
             union fi {
                 float f;
-                uint32_t u;
+                GLbyte bytes[4];
             } fi;
 
-            fi.u = color;
+            fi.bytes[0] = 0;
+            fi.bytes[1] = 0;
+            fi.bytes[2] = 0;
+            fi.bytes[3] = alpha;
             *(*vb)++ = fi.f;
         }
         break;
@@ -1212,15 +1215,15 @@ _cairo_gl_composite_emit_vertex (cairo_gl_context_t *ctx,
                                  cairo_gl_composite_t *setup,
                                  GLfloat x,
                                  GLfloat y,
-                                 uint32_t color)
+                                 uint8_t alpha)
 {
     GLfloat *vb = (GLfloat *) (void *) &ctx->vb[ctx->vb_offset];
 
     *vb++ = x;
     *vb++ = y;
 
-    _cairo_gl_operand_emit (&setup->src, &vb, x, y, color);
-    _cairo_gl_operand_emit (&setup->mask, &vb, x, y, color);
+    _cairo_gl_operand_emit (&setup->src, &vb, x, y, alpha);
+    _cairo_gl_operand_emit (&setup->mask, &vb, x, y, alpha);
 
     ctx->vb_offset += ctx->vertex_size;
 }
@@ -1232,17 +1235,17 @@ _cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
                                GLfloat y1,
                                GLfloat x2,
                                GLfloat y2,
-                               uint32_t color)
+                               uint8_t alpha)
 {
     _cairo_gl_composite_prepare_buffer (ctx, setup, 6);
 
-    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y1, color);
-    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, color);
-    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, color);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y1, alpha);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, alpha);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, alpha);
 
-    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, color);
-    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y2, color);
-    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, color);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, alpha);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x2, y2, alpha);
+    _cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, alpha);
 }
 
 static inline void
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 0cdbe73..dd4e1a4 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -326,7 +326,7 @@ _cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
                                GLfloat y1,
                                GLfloat x2,
                                GLfloat y2,
-                               uint32_t color);
+                               uint8_t alpha);
 
 cairo_private void
 _cairo_gl_composite_emit_glyph (cairo_gl_context_t *ctx,
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 992a40b..671a385 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1113,7 +1113,7 @@ _cairo_gl_render_bounded_spans (void *abstract_renderer,
                                            &renderer->setup,
                                            spans[0].x, y,
                                            spans[1].x, y + height,
-                                           spans[0].coverage << 24);
+                                           spans[0].coverage);
 	}
 
 	spans++;
@@ -1152,7 +1152,7 @@ _cairo_gl_render_unbounded_spans (void *abstract_renderer,
                                        &renderer->setup,
                                        spans[0].x, y,
                                        spans[1].x, y + height,
-                                       spans[0].coverage << 24);
+                                       spans[0].coverage);
 	spans++;
     } while (--num_spans > 1);
 
commit 2a0f34c6da2eb4f10b198d04894fc1413352e041
Author: Benjamin Otte <otte at redhat.com>
Date:   Thu May 20 11:23:18 2010 +0200

    gl: Allow NONE and SPANS sampler for source, too

diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index d2c1973..c6ab07a 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -991,7 +991,9 @@ _cairo_gl_set_shader_by_type (cairo_gl_context_t *ctx,
 
     _cairo_gl_set_shader (ctx, &entry->shader);
 
-    if (source != CAIRO_GL_OPERAND_CONSTANT) {
+    if (source != CAIRO_GL_OPERAND_CONSTANT &&
+	source != CAIRO_GL_OPERAND_SPANS &&
+	source != CAIRO_GL_OPERAND_NONE) {
 	_cairo_gl_shader_bind_texture (ctx, "source_sampler", 0);
     }
     if (mask != CAIRO_GL_OPERAND_CONSTANT &&


More information about the cairo-commit mailing list