From patchwork Thu May 3 10:04:47 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: 8373 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 46FB323E23 for ; Thu, 3 May 2012 10:04:59 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1623EA18562 for ; Thu, 3 May 2012 10:04:58 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so1924808yen.11 for ; Thu, 03 May 2012 03:04:58 -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=io/fJ1wTc0C014rKX2XhvwjXtxoCC/VyaEogJBzq3wy4/z1zI3RBref9OS/JZftoCW jtKS8NIIxkCAFuRYcjteEzsgSqxyfYLck24kRa420LDKEgGWlGwylU1UIIQDEPyKqGZw 2LREJMR1vMGBzzt15rLU4f4bYZ4Gnhzt87NE/84zjzu905+C7vDfsVaXtgjKkWw+G05S gQw3VXxpuqiLH0v+esPfGo72aXcJYP8a2kGMsKBB2yFVNrbrccbenBCwiTiBQm01n4uf d5xsVGrG6FeQED3sFqabyLCFkCu6pYJUV0TuAi4hoLGXF4yxUbBMd7ubiCM244prmgbY fKPA== Received: by 10.50.47.131 with SMTP id d3mr325564ign.33.1336039498781; Thu, 03 May 2012 03:04:58 -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 x6csp7985ibt; Thu, 3 May 2012 03:04:57 -0700 (PDT) Received: by 10.216.138.38 with SMTP id z38mr1041491wei.63.1336039497423; Thu, 03 May 2012 03:04:57 -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 x8si5187791wec.131.2012.05.03.03.04.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 May 2012 03:04:57 -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 a13so1364569wer.37 for ; Thu, 03 May 2012 03:04:56 -0700 (PDT) Received: by 10.216.141.39 with SMTP id f39mr982802wej.90.1336039496677; Thu, 03 May 2012 03:04:56 -0700 (PDT) Received: from localhost (188.4.173.130.dsl.dyn.forthnet.gr. [188.4.173.130]) by mx.google.com with ESMTPS id ea6sm1204208wib.5.2012.05.03.03.04.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 May 2012 03:04:55 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 1/2] gl: Simplify GL wrap parameter setting code Date: Thu, 3 May 2012 13:04:47 +0300 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-Gm-Message-State: ALoCoQkot3qXBBDdSAKPSELOvkHm3EeFC7nQVj0kFo2gohMMYgDEYOLcMwM+KSgtPwavbP7XhnMk 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); } }