[PATCH] gl: Set correct clip region when the destination surface is not texture.

Chuanbo Weng <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
When the destination surface is not texture, it's flipped on the Y axis.
So we should set correct value when using glScissor to set clip region.
Fixes 14 cases(such as partial-clip-text-top) in cairo-test-suite.
---
 src/cairo-gl-composite.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index d9faa05..f2015de 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -757,7 +757,10 @@ _cairo_gl_composite_draw_triangles_with_clip_region (cairo_gl_context_t *ctx,
 	cairo_rectangle_int_t rect;
 	cairo_region_get_rectangle (ctx->clip_region, i, &rect);
 
-	glScissor (rect.x, rect.y, rect.width, rect.height);
+	if (_cairo_gl_surface_is_texture (ctx->current_target))
+	    glScissor (rect.x, rect.y, rect.width, rect.height);
+	else
+	    glScissor (rect.x, ctx->current_target->height-rect.y-rect.height, rect.width, rect.height);
 	_cairo_gl_composite_draw_triangles (ctx, count);
     }
 }
-- 
1.7.5.4

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.