[cairo-commit] src/cairo-gl-composite.c src/cairo-gl-msaa-compositor.c src/cairo-gl-private.h

Martin Robinson mrobinson at kemper.freedesktop.org
Fri Dec 28 14:35:21 PST 2012


 src/cairo-gl-composite.c       |   20 +++++++++-----------
 src/cairo-gl-msaa-compositor.c |   14 +++++++++-----
 src/cairo-gl-private.h         |    9 ++++-----
 3 files changed, 22 insertions(+), 21 deletions(-)

New commits:
commit 21db1c99108dc84166cbd9641f3256b22f571ee3
Author: Martin Robinson <mrobinson at igalia.com>
Date:   Fri Dec 28 14:10:29 2012 -0800

    gl: Cleanup selection of multisampling mode
    
    Fold the choice of multisampling mode into the cairo_gl_composite_t
    structure itself. This makes it more similar to other settings.

diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index e222c44..fa62a87 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -109,6 +109,12 @@ _cairo_gl_composite_set_spans (cairo_gl_composite_t *setup)
 }
 
 void
+_cairo_gl_composite_set_multisample (cairo_gl_composite_t *setup)
+{
+    setup->multisample = TRUE;
+}
+
+void
 _cairo_gl_composite_set_clip_region (cairo_gl_composite_t *setup,
                                      cairo_region_t *clip_region)
 {
@@ -623,9 +629,8 @@ _cairo_gl_composite_setup_clipping (cairo_gl_composite_t *setup,
 }
 
 cairo_status_t
-_cairo_gl_composite_begin_multisample (cairo_gl_composite_t *setup,
-				       cairo_gl_context_t **ctx_out,
-				       cairo_bool_t multisampling)
+_cairo_gl_composite_begin (cairo_gl_composite_t *setup,
+			   cairo_gl_context_t **ctx_out)
 {
     unsigned int dst_size, src_size, mask_size, vertex_size;
     cairo_gl_context_t *ctx;
@@ -639,7 +644,7 @@ _cairo_gl_composite_begin_multisample (cairo_gl_composite_t *setup,
     if (unlikely (status))
 	return status;
 
-    _cairo_gl_context_set_destination (ctx, setup->dst, multisampling);
+    _cairo_gl_context_set_destination (ctx, setup->dst, setup->multisample);
 
     glEnable (GL_BLEND);
 
@@ -716,13 +721,6 @@ FAIL:
     return status;
 }
 
-cairo_status_t
-_cairo_gl_composite_begin (cairo_gl_composite_t *setup,
-                           cairo_gl_context_t **ctx_out)
-{
-    return _cairo_gl_composite_begin_multisample (setup, ctx_out, FALSE);
-}
-
 static inline void
 _cairo_gl_composite_draw_tristrip (cairo_gl_context_t *ctx)
 {
diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index 35715d3..12c416f 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -371,7 +371,9 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t	*compositor,
 
     /* We always use multisampling here, because we do not yet have the smarts
        to calculate when the clip or the source requires it. */
-    status = _cairo_gl_composite_begin_multisample (&setup, &ctx, TRUE);
+     _cairo_gl_composite_set_multisample (&setup);
+
+    status = _cairo_gl_composite_begin (&setup, &ctx);
     if (unlikely (status))
 	goto finish;
 
@@ -539,9 +541,10 @@ _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t	*compositor,
 	goto finish;
 
     _cairo_gl_msaa_compositor_set_clip (composite, &info.setup);
+    if (antialias != CAIRO_ANTIALIAS_NONE)
+	_cairo_gl_composite_set_multisample (&info.setup);
 
-    status = _cairo_gl_composite_begin_multisample (&info.setup, &info.ctx,
-	antialias != CAIRO_ANTIALIAS_NONE);
+    status = _cairo_gl_composite_begin (&info.setup, &info.ctx);
     if (unlikely (status))
 	goto finish;
 
@@ -628,9 +631,10 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t	*compositor,
 	goto cleanup_setup;
 
     _cairo_gl_msaa_compositor_set_clip (composite, &setup);
+    if (antialias != CAIRO_ANTIALIAS_NONE)
+	_cairo_gl_composite_set_multisample (&setup);
 
-    status = _cairo_gl_composite_begin_multisample (&setup, &ctx,
-	antialias != CAIRO_ANTIALIAS_NONE);
+    status = _cairo_gl_composite_begin (&setup, &ctx);
     if (unlikely (status))
 	goto cleanup_setup;
 
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index f174674..57242a4 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -372,6 +372,7 @@ typedef struct _cairo_gl_composite {
     cairo_bool_t spans;
 
     cairo_clip_t *clip;
+    cairo_bool_t multisample;
 } cairo_gl_composite_t;
 
 typedef struct _cairo_gl_font {
@@ -531,15 +532,13 @@ _cairo_gl_composite_set_mask_operand (cairo_gl_composite_t *setup,
 cairo_private void
 _cairo_gl_composite_set_spans (cairo_gl_composite_t *setup);
 
+cairo_private void
+_cairo_gl_composite_set_multisample (cairo_gl_composite_t *setup);
+
 cairo_private cairo_status_t
 _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
                            cairo_gl_context_t **ctx);
 
-cairo_private cairo_status_t
-_cairo_gl_composite_begin_multisample (cairo_gl_composite_t *setup,
-				       cairo_gl_context_t **ctx_out,
-				       cairo_bool_t multisampling);
-
 cairo_private void
 _cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
                                GLfloat x1,


More information about the cairo-commit mailing list