mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
shaped-texture: Use nearest-pixel interpolation if the texture is unscaled
Use nearest-pixel interpolation if the texture is unscaled. This improves performance, especially with software rendering. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=708389
This commit is contained in:
parent
d69553e8f5
commit
dc4e1d4cd1
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <meta/meta-shaped-texture.h>
|
#include <meta/meta-shaped-texture.h>
|
||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
|
#include "clutter-utils.h"
|
||||||
#include "meta-texture-tower.h"
|
#include "meta-texture-tower.h"
|
||||||
|
|
||||||
#include "meta-shaped-texture-private.h"
|
#include "meta-shaped-texture-private.h"
|
||||||
@ -280,6 +281,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
CoglTexture *paint_tex;
|
CoglTexture *paint_tex;
|
||||||
ClutterActorBox alloc;
|
ClutterActorBox alloc;
|
||||||
cairo_region_t *blended_region = NULL;
|
cairo_region_t *blended_region = NULL;
|
||||||
|
CoglPipelineFilter filter;
|
||||||
|
|
||||||
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
|
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
|
||||||
return;
|
return;
|
||||||
@ -316,6 +318,22 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
if (tex_width == 0 || tex_height == 0) /* no contents yet */
|
if (tex_width == 0 || tex_height == 0) /* no contents yet */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Use nearest-pixel interpolation if the texture is unscaled. This
|
||||||
|
* improves performance, especially with software rendering.
|
||||||
|
*/
|
||||||
|
|
||||||
|
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||||
|
|
||||||
|
if (!clutter_actor_is_in_clone_paint (actor))
|
||||||
|
{
|
||||||
|
int x_origin, y_origin;
|
||||||
|
|
||||||
|
if (meta_actor_is_untransformed (actor,
|
||||||
|
&x_origin,
|
||||||
|
&y_origin))
|
||||||
|
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||||
|
}
|
||||||
|
|
||||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
fb = cogl_get_draw_framebuffer ();
|
fb = cogl_get_draw_framebuffer ();
|
||||||
|
|
||||||
@ -344,6 +362,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
|
|
||||||
opaque_pipeline = get_unblended_pipeline (ctx);
|
opaque_pipeline = get_unblended_pipeline (ctx);
|
||||||
cogl_pipeline_set_layer_texture (opaque_pipeline, 0, paint_tex);
|
cogl_pipeline_set_layer_texture (opaque_pipeline, 0, paint_tex);
|
||||||
|
cogl_pipeline_set_layer_filters (opaque_pipeline, 0, filter, filter);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = cairo_region_num_rectangles (region);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
@ -385,9 +404,11 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
{
|
{
|
||||||
pipeline = get_masked_pipeline (ctx);
|
pipeline = get_masked_pipeline (ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 1, priv->mask_texture);
|
cogl_pipeline_set_layer_texture (pipeline, 1, priv->mask_texture);
|
||||||
|
cogl_pipeline_set_layer_filters (pipeline, 1, filter, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, paint_tex);
|
cogl_pipeline_set_layer_texture (pipeline, 0, paint_tex);
|
||||||
|
cogl_pipeline_set_layer_filters (pipeline, 0, filter, filter);
|
||||||
|
|
||||||
{
|
{
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
|
Loading…
Reference in New Issue
Block a user