From patchwork Mon Jul 25 13:56:32 2011 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: 3079 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 4CE5D23E54 for ; Mon, 25 Jul 2011 13:57:13 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0FB3AA18471 for ; Mon, 25 Jul 2011 13:57:12 +0000 (UTC) Received: by mail-qw0-f52.google.com with SMTP id 8so3003702qwb.11 for ; Mon, 25 Jul 2011 06:57:12 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr3469590qcc.148.1311602232800; Mon, 25 Jul 2011 06:57:12 -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.229.217.78 with SMTP id hl14cs77870qcb; Mon, 25 Jul 2011 06:57:12 -0700 (PDT) Received: by 10.213.100.9 with SMTP id w9mr218073ebn.13.1311602231271; Mon, 25 Jul 2011 06:57:11 -0700 (PDT) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by mx.google.com with ESMTPS id 18si7042659fat.105.2011.07.25.06.57.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.161.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by mail-fx0-f44.google.com with SMTP id 6so6802455fxe.17 for ; Mon, 25 Jul 2011 06:57:10 -0700 (PDT) Received: by 10.223.145.16 with SMTP id b16mr4140606fav.128.1311602230812; Mon, 25 Jul 2011 06:57:10 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id x13sm3808477fah.5.2011.07.25.06.57.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:09 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 05/21] gl: Add functions to get the filter and extend of gl operands. Date: Mon, 25 Jul 2011 16:56:32 +0300 Message-Id: <1311602208-5973-5-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis Signed-off-by: Chris Wilson --- src/cairo-gl-composite.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ src/cairo-gl-private.h | 8 ++++++ 2 files changed, 65 insertions(+), 0 deletions(-) diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index 05982c4..1a4467e 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -308,6 +308,63 @@ _cairo_gl_operand_init (cairo_gl_operand_t *operand, } } +cairo_filter_t +_cairo_gl_operand_get_filter (cairo_gl_operand_t *operand) +{ + cairo_filter_t filter; + + switch ((int) operand->type) { + case CAIRO_GL_OPERAND_TEXTURE: + filter = operand->texture.attributes.filter; + break; + case CAIRO_GL_OPERAND_LINEAR_GRADIENT: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: + filter = CAIRO_FILTER_BILINEAR; + break; + default: + filter = CAIRO_FILTER_DEFAULT; + break; + } + + return filter; +} + +GLint +_cairo_gl_operand_get_gl_filter (cairo_gl_operand_t *operand) +{ + cairo_filter_t filter = _cairo_gl_operand_get_filter (operand); + + return filter != CAIRO_FILTER_FAST && filter != CAIRO_FILTER_NEAREST ? + GL_LINEAR : + GL_NEAREST; +} + +cairo_extend_t +_cairo_gl_operand_get_extend (cairo_gl_operand_t *operand) +{ + cairo_extend_t extend; + + switch ((int) operand->type) { + case CAIRO_GL_OPERAND_TEXTURE: + extend = operand->texture.attributes.extend; + break; + case CAIRO_GL_OPERAND_LINEAR_GRADIENT: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: + extend = operand->gradient.extend; + break; + default: + extend = CAIRO_EXTEND_NONE; + break; + } + + return extend; +} + + cairo_int_status_t _cairo_gl_composite_set_source (cairo_gl_composite_t *setup, const cairo_pattern_t *pattern, diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h index e4f1cce..6f1d410 100644 --- a/src/cairo-gl-private.h +++ b/src/cairo-gl-private.h @@ -575,6 +575,14 @@ cairo_private cairo_status_t _cairo_gl_dispatch_init(cairo_gl_dispatch_t *dispatch, cairo_gl_get_proc_addr_func_t get_proc_addr); +cairo_private cairo_filter_t +_cairo_gl_operand_get_filter (cairo_gl_operand_t *operand); + +cairo_private GLint +_cairo_gl_operand_get_gl_filter (cairo_gl_operand_t *operand); + +cairo_private cairo_extend_t +_cairo_gl_operand_get_extend (cairo_gl_operand_t *operand); slim_hidden_proto (cairo_gl_surface_create); slim_hidden_proto (cairo_gl_surface_create_for_texture);