[cairo] [PATCH] gl/msaa: Fix glScissor bounds

Martin Robinson mrobinson at igalia.com
Fri Oct 14 16:08:09 PDT 2011


From: Martin Robinson <mrobinson at igalia.com>

When scissoring the compositing extents for windows, flip
the y coordinate as windows use a projection matrix that
does the same.
---
 src/cairo-gl-msaa-compositor.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index 01ef40f..08a4a2b 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -268,6 +268,18 @@ _prevent_overlapping_drawing (cairo_clip_t	*clip,
     glStencilOp (GL_ZERO, GL_ZERO, GL_ZERO);
 }
 
+static void
+_scissor_composite_extents (cairo_gl_surface_t		*surface,
+			    cairo_rectangle_int_t	*rect)
+{
+    int y = rect->y;
+    if (_cairo_gl_surface_is_texture (surface) == FALSE)
+	y = surface->height - (rect->y + rect->height);
+
+    glScissor (rect->x, y, rect->width, rect->height);
+    glEnable (GL_SCISSOR_TEST);
+}
+
 static cairo_int_status_t
 _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t	*compositor,
 				  cairo_composite_rectangles_t	*composite,
@@ -312,9 +324,7 @@ _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t	*compositor,
     if (unlikely (status))
 	goto finish;
 
-    glScissor (composite->unbounded.x, composite->unbounded.y,
-	       composite->unbounded.width, composite->unbounded.height);
-    glEnable (GL_SCISSOR_TEST);
+    _scissor_composite_extents (dst, &composite->unbounded);
 
     if (! _cairo_composite_rectangles_can_reduce_clip (composite,
 						       composite->clip))
@@ -398,9 +408,7 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t	*compositor,
     if (unlikely (status))
 	goto cleanup_setup;
 
-    glScissor (composite->unbounded.x, composite->unbounded.y,
-	       composite->unbounded.width, composite->unbounded.height);
-    glEnable (GL_SCISSOR_TEST);
+    _scissor_composite_extents (dst, &composite->unbounded);
 
     if (! _cairo_composite_rectangles_can_reduce_clip (composite,
 						       composite->clip))
-- 
1.7.7.237.g34c4



More information about the cairo mailing list