From patchwork Thu May 3 10:03:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 8372 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CAB1423E23 for ; Thu, 3 May 2012 10:03:38 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 9343FA187FA for ; Thu, 3 May 2012 10:03:38 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1952459yhp.11 for ; Thu, 03 May 2012 03:03:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=vDBtYPffQ5EfPHukZE8B2ntdS5vSRIXS8tvKYmSyiZU=; b=F2mmFGDvUQoR669LnvPTNk8V6LHeJ46E2GDGtB82gK3wLGNRSW9n1cGk6eir2XMR0v y/tLPdXPQmZW7eyQfUN/owiv0heWsJuE6FMJLxwJTq8fmjam4Qk7A1TV2755BIPVJCka jyF77uHV1vpCFlFa2ZXBOfbnPi6Xx5TZ4FQein8jzRdrkcnDNcg2PomgzSHgEKMHl2hB 53pkiLT6TThXtLCJN0fO32dxj4smUTYYFHcWO1UkRptrxsBpKgOyDVfdP2zaXxjZBCO5 Mv1ak0XKWcmbY4DUX7Y4kICKfpcbqAd3QTGanKW/om4g+OGhDtQeyLppKzFB6MfD2ybe yMPw== Received: by 10.50.10.225 with SMTP id l1mr370362igb.1.1336039417883; Thu, 03 May 2012 03:03:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp7930ibt; Thu, 3 May 2012 03:03:37 -0700 (PDT) Received: by 10.180.104.137 with SMTP id ge9mr1696340wib.20.1336039416762; Thu, 03 May 2012 03:03:36 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id z8si693635wiw.32.2012.05.03.03.03.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 May 2012 03:03:36 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by wera13 with SMTP id a13so1363608wer.37 for ; Thu, 03 May 2012 03:03:36 -0700 (PDT) Received: by 10.180.78.164 with SMTP id c4mr1778438wix.10.1336039415763; Thu, 03 May 2012 03:03:35 -0700 (PDT) Received: from localhost (188.4.173.130.dsl.dyn.forthnet.gr. [188.4.173.130]) by mx.google.com with ESMTPS id j3sm1959100wiw.1.2012.05.03.03.03.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 May 2012 03:03:34 -0700 (PDT) From: alexandros.frantzis@linaro.org To: cairo@cairographics.org Subject: [PATCH 1/2] gl: Simplify GL wrap parameter setting code Date: Thu, 3 May 2012 13:03:26 +0300 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-Gm-Message-State: ALoCoQnJAf9L7r8ZDCieYa8wz4QK7Lve1dtnj+E2Z8Yq+p/SRUcTqhB1JfVCT99kwxZ/ooPh3W6a From: Alexandros Frantzis --- 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); } }