[cairo] [PATCH 1/2] gl: Simplify GL wrap parameter setting code
Henry (Yu) Song - SISA
hsong at sisa.samsung.com
Fri May 11 09:41:04 PDT 2012
Hi, Alex
I could not apply your 1/2. 2/2 patches on latest snapshot. Would you please check them? I modified your 1/2 patch a little and that applies fine, but 2/2 patch has too much difference, hard to manually adjust.
Thanks
Henry
________________________________________
From: cairo-bounces+hsong=sisa.samsung.com at cairographics.org [cairo-bounces+hsong=sisa.samsung.com at cairographics.org] on behalf of alexandros.frantzis at linaro.org [alexandros.frantzis at linaro.org]
Sent: Thursday, May 03, 2012 3:03 AM
To: cairo at cairographics.org
Subject: [cairo] [PATCH 1/2] gl: Simplify GL wrap parameter setting code
From: Alexandros Frantzis <alexandros.frantzis at linaro.org>
---
src/cairo-gl-composite.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index bd7c675..633d229 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -153,32 +153,33 @@ _cairo_gl_texture_set_extend (cairo_gl_context_t *ctx,
GLuint target,
cairo_extend_t extend)
{
+ GLint wrap_mode;
assert (! _cairo_gl_device_requires_power_of_two_textures (&ctx->base) ||
(extend != CAIRO_EXTEND_REPEAT && extend != CAIRO_EXTEND_REFLECT));
switch (extend) {
case CAIRO_EXTEND_NONE:
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) {
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- }
- else {
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- }
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES)
+ wrap_mode = GL_CLAMP_TO_EDGE;
+ else
+ wrap_mode = GL_CLAMP_TO_BORDER;
break;
case CAIRO_EXTEND_PAD:
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ wrap_mode = GL_CLAMP_TO_EDGE;
break;
case CAIRO_EXTEND_REPEAT:
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ wrap_mode = GL_REPEAT;
break;
case CAIRO_EXTEND_REFLECT:
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ wrap_mode = GL_MIRRORED_REPEAT;
break;
+ default:
+ wrap_mode = 0;
+ }
+
+ if (likely (wrap_mode)) {
+ glTexParameteri (target, GL_TEXTURE_WRAP_S, wrap_mode);
+ glTexParameteri (target, GL_TEXTURE_WRAP_T, wrap_mode);
}
}
--
1.7.9.5
--
cairo mailing list
cairo at cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list