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

Chuanbo Weng strgnm at gmail.com
Sat Jun 23 20:03:45 PDT 2012


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



More information about the cairo mailing list