|
|
f73d56 |
From 1102736013ac02280043c5ee7bc02b5b493dfb08 Mon Sep 17 00:00:00 2001
|
|
|
f73d56 |
From: Hans Petter Jansson <hpj@cl.no>
|
|
|
f73d56 |
Date: Thu, 10 Oct 2013 02:38:52 +0200
|
|
|
f73d56 |
Subject: [PATCH] shaped-texture: Use nearest-pixel interpolation if the
|
|
|
f73d56 |
texture is unscaled
|
|
|
f73d56 |
|
|
|
f73d56 |
Use nearest-pixel interpolation if the texture is unscaled. This
|
|
|
f73d56 |
improves performance, especially with software rendering.
|
|
|
f73d56 |
|
|
|
f73d56 |
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=708389
|
|
|
f73d56 |
|
|
|
f73d56 |
Conflicts:
|
|
|
f73d56 |
src/compositor/meta-shaped-texture.c
|
|
|
f73d56 |
---
|
|
|
f73d56 |
src/compositor/meta-shaped-texture.c | 20 ++++++++++++++++++++
|
|
|
f73d56 |
1 file changed, 20 insertions(+)
|
|
|
f73d56 |
|
|
|
f73d56 |
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
|
|
|
f73d56 |
index c6239c9..9cb709d 100644
|
|
|
f73d56 |
--- a/src/compositor/meta-shaped-texture.c
|
|
|
f73d56 |
+++ b/src/compositor/meta-shaped-texture.c
|
|
|
f73d56 |
@@ -30,6 +30,7 @@
|
|
|
f73d56 |
#include <config.h>
|
|
|
f73d56 |
|
|
|
f73d56 |
#include <meta/meta-shaped-texture.h>
|
|
|
f73d56 |
+#include "clutter-utils.h"
|
|
|
f73d56 |
#include "meta-texture-tower.h"
|
|
|
f73d56 |
|
|
|
f73d56 |
#include <clutter/clutter.h>
|
|
|
f73d56 |
@@ -141,6 +142,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|
|
f73d56 |
static CoglPipeline *pipeline_unshaped_template = NULL;
|
|
|
f73d56 |
|
|
|
f73d56 |
CoglPipeline *pipeline;
|
|
|
f73d56 |
+ CoglPipelineFilter filter;
|
|
|
f73d56 |
|
|
|
f73d56 |
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
|
|
|
f73d56 |
return;
|
|
|
f73d56 |
@@ -177,6 +179,22 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|
|
f73d56 |
if (tex_width == 0 || tex_height == 0) /* no contents yet */
|
|
|
f73d56 |
return;
|
|
|
f73d56 |
|
|
|
f73d56 |
+ /* Use nearest-pixel interpolation if the texture is unscaled. This
|
|
|
f73d56 |
+ * improves performance, especially with software rendering.
|
|
|
f73d56 |
+ */
|
|
|
f73d56 |
+
|
|
|
f73d56 |
+ filter = COGL_PIPELINE_FILTER_LINEAR;
|
|
|
f73d56 |
+
|
|
|
f73d56 |
+ if (!clutter_actor_is_in_clone_paint (actor))
|
|
|
f73d56 |
+ {
|
|
|
f73d56 |
+ int x_origin, y_origin;
|
|
|
f73d56 |
+
|
|
|
f73d56 |
+ if (meta_actor_is_untransformed (actor,
|
|
|
f73d56 |
+ &x_origin,
|
|
|
f73d56 |
+ &y_origin))
|
|
|
f73d56 |
+ filter = COGL_PIPELINE_FILTER_NEAREST;
|
|
|
f73d56 |
+ }
|
|
|
f73d56 |
+
|
|
|
f73d56 |
if (priv->mask_texture == NULL)
|
|
|
f73d56 |
{
|
|
|
f73d56 |
/* Use a single-layer texture if we don't have a mask. */
|
|
|
f73d56 |
@@ -210,9 +228,11 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|
|
f73d56 |
pipeline = priv->pipeline;
|
|
|
f73d56 |
|
|
|
f73d56 |
cogl_pipeline_set_layer_texture (pipeline, 1, priv->mask_texture);
|
|
|
f73d56 |
+ cogl_pipeline_set_layer_filters (pipeline, 1, filter, filter);
|
|
|
f73d56 |
}
|
|
|
f73d56 |
|
|
|
f73d56 |
cogl_pipeline_set_layer_texture (pipeline, 0, paint_tex);
|
|
|
f73d56 |
+ cogl_pipeline_set_layer_filters (pipeline, 0, filter, filter);
|
|
|
f73d56 |
|
|
|
f73d56 |
{
|
|
|
f73d56 |
CoglColor color;
|
|
|
f73d56 |
--
|
|
|
f73d56 |
1.8.3.1
|
|
|
f73d56 |
|