2020-01-07 14:34:03 -05:00
|
|
|
/* shell-blur-effect.c
|
|
|
|
*
|
|
|
|
* Copyright 2019 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "shell-blur-effect.h"
|
|
|
|
|
|
|
|
#include "shell-enum-types.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:shell-blur-effect
|
|
|
|
* @short_description: Blur effect for actors
|
|
|
|
*
|
2020-12-09 17:20:16 -05:00
|
|
|
* #ShellBlurEffect is a blur implementation based on Clutter. It also has
|
2020-08-19 05:26:11 -04:00
|
|
|
* an optional brightness property.
|
2020-01-07 14:34:03 -05:00
|
|
|
*
|
|
|
|
* # Modes
|
|
|
|
*
|
|
|
|
* #ShellBlurEffect can work in @SHELL_BLUR_MODE_BACKGROUND and @SHELL_BLUR_MODE_ACTOR
|
|
|
|
* modes. The actor mode blurs the actor itself, and all of its children. The
|
|
|
|
* background mode blurs the pixels beneath the actor, but not the actor itself.
|
|
|
|
*
|
|
|
|
* @SHELL_BLUR_MODE_BACKGROUND can be computationally expensive, since the contents
|
|
|
|
* beneath the actor cannot be cached, so beware of the performance implications
|
|
|
|
* of using this blur mode.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const gchar *brightness_glsl_declarations =
|
2020-02-10 09:34:03 -05:00
|
|
|
"uniform float brightness; \n";
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
static const gchar *brightness_glsl =
|
2020-02-10 09:34:03 -05:00
|
|
|
" cogl_color_out.rgb *= brightness; \n";
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
#define MIN_DOWNSCALE_SIZE 256.f
|
2020-02-10 09:34:57 -05:00
|
|
|
#define MAX_SIGMA 6.f
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
ACTOR_PAINTED = 1 << 0,
|
|
|
|
BLUR_APPLIED = 1 << 1,
|
|
|
|
} CacheFlags;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglFramebuffer *framebuffer;
|
|
|
|
CoglPipeline *pipeline;
|
|
|
|
CoglTexture *texture;
|
|
|
|
} FramebufferData;
|
|
|
|
|
|
|
|
struct _ShellBlurEffect
|
|
|
|
{
|
|
|
|
ClutterEffect parent_instance;
|
|
|
|
|
|
|
|
ClutterActor *actor;
|
|
|
|
|
|
|
|
unsigned int tex_width;
|
|
|
|
unsigned int tex_height;
|
|
|
|
|
|
|
|
/* The cached contents */
|
|
|
|
FramebufferData actor_fb;
|
|
|
|
CacheFlags cache_flags;
|
|
|
|
|
|
|
|
FramebufferData background_fb;
|
|
|
|
FramebufferData brightness_fb;
|
|
|
|
int brightness_uniform;
|
|
|
|
|
|
|
|
ShellBlurMode mode;
|
|
|
|
float downscale_factor;
|
|
|
|
float brightness;
|
2020-02-10 09:34:57 -05:00
|
|
|
int sigma;
|
2020-01-07 14:34:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (ShellBlurEffect, shell_blur_effect, CLUTTER_TYPE_EFFECT)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
2020-02-10 09:34:57 -05:00
|
|
|
PROP_SIGMA,
|
2020-01-07 14:34:03 -05:00
|
|
|
PROP_BRIGHTNESS,
|
|
|
|
PROP_MODE,
|
|
|
|
N_PROPS
|
|
|
|
};
|
|
|
|
|
|
|
|
static GParamSpec *properties [N_PROPS] = { NULL, };
|
|
|
|
|
|
|
|
static CoglPipeline*
|
|
|
|
create_base_pipeline (void)
|
|
|
|
{
|
|
|
|
static CoglPipeline *base_pipeline = NULL;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (base_pipeline == NULL))
|
|
|
|
{
|
|
|
|
CoglContext *ctx =
|
|
|
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
|
|
|
|
|
|
|
base_pipeline = cogl_pipeline_new (ctx);
|
|
|
|
cogl_pipeline_set_layer_null_texture (base_pipeline, 0);
|
|
|
|
cogl_pipeline_set_layer_filters (base_pipeline,
|
|
|
|
0,
|
|
|
|
COGL_PIPELINE_FILTER_LINEAR,
|
|
|
|
COGL_PIPELINE_FILTER_LINEAR);
|
|
|
|
cogl_pipeline_set_layer_wrap_mode (base_pipeline,
|
|
|
|
0,
|
|
|
|
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return cogl_pipeline_copy (base_pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
static CoglPipeline*
|
|
|
|
create_brightness_pipeline (void)
|
|
|
|
{
|
|
|
|
static CoglPipeline *brightness_pipeline = NULL;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (brightness_pipeline == NULL))
|
|
|
|
{
|
|
|
|
CoglSnippet *snippet;
|
|
|
|
|
|
|
|
brightness_pipeline = create_base_pipeline ();
|
|
|
|
|
|
|
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
|
|
|
brightness_glsl_declarations,
|
|
|
|
brightness_glsl);
|
|
|
|
cogl_pipeline_add_snippet (brightness_pipeline, snippet);
|
|
|
|
cogl_object_unref (snippet);
|
|
|
|
}
|
|
|
|
|
|
|
|
return cogl_pipeline_copy (brightness_pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2020-12-09 17:20:16 -05:00
|
|
|
update_brightness (ShellBlurEffect *self,
|
|
|
|
uint8_t paint_opacity)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-12-09 17:20:16 -05:00
|
|
|
cogl_pipeline_set_color4ub (self->brightness_fb.pipeline,
|
|
|
|
paint_opacity,
|
|
|
|
paint_opacity,
|
|
|
|
paint_opacity,
|
|
|
|
paint_opacity);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
if (self->brightness_uniform > -1)
|
|
|
|
{
|
|
|
|
cogl_pipeline_set_uniform_1f (self->brightness_fb.pipeline,
|
|
|
|
self->brightness_uniform,
|
|
|
|
self->brightness);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_projection_matrix (CoglFramebuffer *framebuffer,
|
|
|
|
float width,
|
2020-02-10 09:22:33 -05:00
|
|
|
float height)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-09-11 14:49:29 -04:00
|
|
|
graphene_matrix_t projection;
|
|
|
|
|
|
|
|
graphene_matrix_init_translate (&projection,
|
|
|
|
&GRAPHENE_POINT3D_INIT (-width / 2.0,
|
|
|
|
-height / 2.0,
|
|
|
|
0.f));
|
|
|
|
graphene_matrix_scale (&projection, 2.0 / width, -2.0 / height, 1.f);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
cogl_framebuffer_set_projection_matrix (framebuffer, &projection);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_fbo (FramebufferData *data,
|
|
|
|
unsigned int width,
|
|
|
|
unsigned int height,
|
|
|
|
float downscale_factor)
|
|
|
|
{
|
|
|
|
CoglContext *ctx =
|
|
|
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
|
|
|
|
|
|
|
g_clear_pointer (&data->texture, cogl_object_unref);
|
2020-10-13 09:51:22 -04:00
|
|
|
g_clear_object (&data->framebuffer);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-02-10 09:22:33 -05:00
|
|
|
float new_width = floorf (width / downscale_factor);
|
|
|
|
float new_height = floorf (height / downscale_factor);
|
|
|
|
|
|
|
|
data->texture = cogl_texture_2d_new_with_size (ctx, new_width, new_height);
|
2020-01-07 14:34:03 -05:00
|
|
|
if (!data->texture)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
cogl_pipeline_set_layer_texture (data->pipeline, 0, data->texture);
|
|
|
|
|
2020-10-13 09:51:22 -04:00
|
|
|
data->framebuffer =
|
|
|
|
COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (data->texture));
|
2020-01-07 14:34:03 -05:00
|
|
|
if (!data->framebuffer)
|
|
|
|
{
|
|
|
|
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-02-10 09:22:33 -05:00
|
|
|
setup_projection_matrix (data->framebuffer, new_width, new_height);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_actor_fbo (ShellBlurEffect *self,
|
|
|
|
unsigned int width,
|
|
|
|
unsigned int height,
|
|
|
|
float downscale_factor)
|
|
|
|
{
|
|
|
|
if (self->tex_width == width &&
|
|
|
|
self->tex_height == height &&
|
|
|
|
self->downscale_factor == downscale_factor &&
|
|
|
|
self->actor_fb.framebuffer)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
self->cache_flags &= ~ACTOR_PAINTED;
|
|
|
|
|
|
|
|
return update_fbo (&self->actor_fb, width, height, downscale_factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_brightness_fbo (ShellBlurEffect *self,
|
|
|
|
unsigned int width,
|
|
|
|
unsigned int height,
|
|
|
|
float downscale_factor)
|
|
|
|
{
|
|
|
|
if (self->tex_width == width &&
|
|
|
|
self->tex_height == height &&
|
|
|
|
self->downscale_factor == downscale_factor &&
|
|
|
|
self->brightness_fb.framebuffer)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return update_fbo (&self->brightness_fb,
|
|
|
|
width, height,
|
|
|
|
downscale_factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_background_fbo (ShellBlurEffect *self,
|
2020-02-13 07:07:55 -05:00
|
|
|
unsigned int width,
|
|
|
|
unsigned int height)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
if (self->tex_width == width &&
|
|
|
|
self->tex_height == height &&
|
|
|
|
self->background_fb.framebuffer)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return update_fbo (&self->background_fb, width, height, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clear_framebuffer_data (FramebufferData *fb_data)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&fb_data->texture, cogl_object_unref);
|
2020-10-13 09:51:22 -04:00
|
|
|
g_clear_object (&fb_data->framebuffer);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static float
|
|
|
|
calculate_downscale_factor (float width,
|
|
|
|
float height,
|
2020-02-10 09:34:57 -05:00
|
|
|
float sigma)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
float downscale_factor = 1.0;
|
|
|
|
float scaled_width = width;
|
|
|
|
float scaled_height = height;
|
2020-02-10 09:34:57 -05:00
|
|
|
float scaled_sigma = sigma;
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
/* This is the algorithm used by Firefox; keep downscaling until either the
|
|
|
|
* blur radius is lower than the threshold, or the downscaled texture is too
|
|
|
|
* small.
|
|
|
|
*/
|
2020-02-10 09:34:57 -05:00
|
|
|
while (scaled_sigma > MAX_SIGMA &&
|
2020-01-07 14:34:03 -05:00
|
|
|
scaled_width > MIN_DOWNSCALE_SIZE &&
|
|
|
|
scaled_height > MIN_DOWNSCALE_SIZE)
|
|
|
|
{
|
|
|
|
downscale_factor *= 2.f;
|
|
|
|
|
|
|
|
scaled_width = width / downscale_factor;
|
|
|
|
scaled_height = height / downscale_factor;
|
2020-02-10 09:34:57 -05:00
|
|
|
scaled_sigma = sigma / downscale_factor;
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return downscale_factor;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_set_actor (ClutterActorMeta *meta,
|
|
|
|
ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ShellBlurEffect *self = SHELL_BLUR_EFFECT (meta);
|
|
|
|
ClutterActorMetaClass *meta_class;
|
|
|
|
|
|
|
|
meta_class = CLUTTER_ACTOR_META_CLASS (shell_blur_effect_parent_class);
|
|
|
|
meta_class->set_actor (meta, actor);
|
|
|
|
|
|
|
|
/* clear out the previous state */
|
|
|
|
clear_framebuffer_data (&self->actor_fb);
|
2020-02-13 07:08:28 -05:00
|
|
|
clear_framebuffer_data (&self->background_fb);
|
2020-01-07 14:34:03 -05:00
|
|
|
clear_framebuffer_data (&self->brightness_fb);
|
|
|
|
|
|
|
|
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
|
|
|
self->actor = clutter_actor_meta_get_actor (meta);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-02-12 17:02:14 -05:00
|
|
|
update_actor_box (ShellBlurEffect *self,
|
|
|
|
ClutterPaintContext *paint_context,
|
|
|
|
ClutterActorBox *source_actor_box)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-02-12 17:02:14 -05:00
|
|
|
ClutterStageView *stage_view;
|
|
|
|
float box_scale_factor = 1.0f;
|
|
|
|
float origin_x, origin_y;
|
|
|
|
float width, height;
|
|
|
|
|
|
|
|
switch (self->mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
|
|
|
clutter_actor_get_allocation_box (self->actor, source_actor_box);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
|
|
|
stage_view = clutter_paint_context_get_stage_view (paint_context);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-02-12 17:02:14 -05:00
|
|
|
clutter_actor_get_transformed_position (self->actor, &origin_x, &origin_y);
|
|
|
|
clutter_actor_get_transformed_size (self->actor, &width, &height);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2021-02-13 10:07:22 -05:00
|
|
|
if (stage_view)
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t stage_view_layout;
|
|
|
|
|
|
|
|
box_scale_factor = clutter_stage_view_get_scale (stage_view);
|
|
|
|
clutter_stage_view_get_layout (stage_view, &stage_view_layout);
|
|
|
|
|
|
|
|
origin_x -= stage_view_layout.x;
|
|
|
|
origin_y -= stage_view_layout.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If we're drawing off stage, just assume scale = 1, this won't work
|
|
|
|
* with stage-view scaling though.
|
|
|
|
*/
|
|
|
|
}
|
2020-02-12 17:02:14 -05:00
|
|
|
|
|
|
|
clutter_actor_box_set_origin (source_actor_box, origin_x, origin_y);
|
|
|
|
clutter_actor_box_set_size (source_actor_box, width, height);
|
|
|
|
|
|
|
|
clutter_actor_box_scale (source_actor_box, box_scale_factor);
|
|
|
|
break;
|
|
|
|
}
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-02-12 17:02:14 -05:00
|
|
|
clutter_actor_box_clamp_to_pixel (source_actor_box);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-06-29 14:35:02 -04:00
|
|
|
add_blurred_pipeline (ShellBlurEffect *self,
|
2020-12-09 17:20:16 -05:00
|
|
|
ClutterPaintNode *node,
|
|
|
|
uint8_t paint_opacity)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-06-29 14:35:02 -04:00
|
|
|
g_autoptr (ClutterPaintNode) pipeline_node = NULL;
|
2020-01-07 14:34:03 -05:00
|
|
|
float width, height;
|
|
|
|
|
|
|
|
/* Use the untransformed actor size here, since the framebuffer itself already
|
|
|
|
* has the actor transform matrix applied.
|
|
|
|
*/
|
|
|
|
clutter_actor_get_size (self->actor, &width, &height);
|
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
update_brightness (self, paint_opacity);
|
2020-06-29 14:35:02 -04:00
|
|
|
|
|
|
|
pipeline_node = clutter_pipeline_node_new (self->brightness_fb.pipeline);
|
|
|
|
clutter_paint_node_set_static_name (pipeline_node, "ShellBlurEffect (final)");
|
|
|
|
clutter_paint_node_add_child (node, pipeline_node);
|
|
|
|
|
|
|
|
clutter_paint_node_add_rectangle (pipeline_node,
|
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
});
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
static ClutterPaintNode *
|
|
|
|
create_blur_nodes (ShellBlurEffect *self,
|
|
|
|
ClutterPaintNode *node,
|
|
|
|
uint8_t paint_opacity)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-06-29 14:35:02 -04:00
|
|
|
g_autoptr (ClutterPaintNode) brightness_node = NULL;
|
2020-12-09 17:20:16 -05:00
|
|
|
g_autoptr (ClutterPaintNode) blur_node = NULL;
|
2020-06-29 14:35:02 -04:00
|
|
|
float width;
|
|
|
|
float height;
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
clutter_actor_get_size (self->actor, &width, &height);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
update_brightness (self, paint_opacity);
|
2020-06-29 14:35:02 -04:00
|
|
|
brightness_node = clutter_layer_node_new_to_framebuffer (self->brightness_fb.framebuffer,
|
|
|
|
self->brightness_fb.pipeline);
|
|
|
|
clutter_paint_node_set_static_name (brightness_node, "ShellBlurEffect (brightness)");
|
|
|
|
clutter_paint_node_add_child (node, brightness_node);
|
|
|
|
clutter_paint_node_add_rectangle (brightness_node,
|
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
width, height,
|
|
|
|
});
|
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
blur_node = clutter_blur_node_new (self->tex_width / self->downscale_factor,
|
|
|
|
self->tex_height / self->downscale_factor,
|
|
|
|
self->sigma / self->downscale_factor);
|
|
|
|
clutter_paint_node_set_static_name (blur_node, "ShellBlurEffect (blur)");
|
|
|
|
clutter_paint_node_add_child (brightness_node, blur_node);
|
|
|
|
clutter_paint_node_add_rectangle (blur_node,
|
2020-06-29 14:35:02 -04:00
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
cogl_texture_get_width (self->brightness_fb.texture),
|
|
|
|
cogl_texture_get_height (self->brightness_fb.texture),
|
|
|
|
});
|
|
|
|
|
2020-01-07 14:34:03 -05:00
|
|
|
self->cache_flags |= BLUR_APPLIED;
|
2020-06-29 14:35:02 -04:00
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
return g_steal_pointer (&blur_node);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
static void
|
2020-01-07 14:34:03 -05:00
|
|
|
paint_background (ShellBlurEffect *self,
|
2020-06-29 14:35:02 -04:00
|
|
|
ClutterPaintNode *node,
|
2020-02-12 17:02:14 -05:00
|
|
|
ClutterPaintContext *paint_context,
|
|
|
|
ClutterActorBox *source_actor_box)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-06-29 14:35:02 -04:00
|
|
|
g_autoptr (ClutterPaintNode) background_node = NULL;
|
|
|
|
g_autoptr (ClutterPaintNode) blit_node = NULL;
|
|
|
|
CoglFramebuffer *src;
|
2020-02-12 17:02:14 -05:00
|
|
|
float transformed_x;
|
|
|
|
float transformed_y;
|
|
|
|
float transformed_width;
|
|
|
|
float transformed_height;
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-02-12 17:02:14 -05:00
|
|
|
clutter_actor_box_get_origin (source_actor_box,
|
|
|
|
&transformed_x,
|
|
|
|
&transformed_y);
|
|
|
|
clutter_actor_box_get_size (source_actor_box,
|
|
|
|
&transformed_width,
|
|
|
|
&transformed_height);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
/* Background layer node */
|
|
|
|
background_node =
|
|
|
|
clutter_layer_node_new_to_framebuffer (self->background_fb.framebuffer,
|
|
|
|
self->background_fb.pipeline);
|
|
|
|
clutter_paint_node_set_static_name (background_node, "ShellBlurEffect (background)");
|
|
|
|
clutter_paint_node_add_child (node, background_node);
|
|
|
|
clutter_paint_node_add_rectangle (background_node,
|
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
self->tex_width / self->downscale_factor,
|
|
|
|
self->tex_height / self->downscale_factor,
|
|
|
|
});
|
|
|
|
|
|
|
|
/* Blit node */
|
|
|
|
src = clutter_paint_context_get_framebuffer (paint_context);
|
|
|
|
blit_node = clutter_blit_node_new (src);
|
|
|
|
clutter_paint_node_set_static_name (blit_node, "ShellBlurEffect (blit)");
|
|
|
|
clutter_paint_node_add_child (background_node, blit_node);
|
|
|
|
clutter_blit_node_add_blit_rectangle (CLUTTER_BLIT_NODE (blit_node),
|
|
|
|
transformed_x,
|
|
|
|
transformed_y,
|
|
|
|
0, 0,
|
|
|
|
transformed_width,
|
|
|
|
transformed_height);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2020-02-12 17:02:14 -05:00
|
|
|
update_framebuffers (ShellBlurEffect *self,
|
|
|
|
ClutterPaintContext *paint_context,
|
|
|
|
ClutterActorBox *source_actor_box)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
gboolean updated = FALSE;
|
|
|
|
float downscale_factor;
|
|
|
|
float height = -1;
|
|
|
|
float width = -1;
|
|
|
|
|
2020-02-12 17:02:14 -05:00
|
|
|
clutter_actor_box_get_size (source_actor_box, &width, &height);
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
downscale_factor = calculate_downscale_factor (width, height, self->sigma);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
updated = update_actor_fbo (self, width, height, downscale_factor) &&
|
|
|
|
update_brightness_fbo (self, width, height, downscale_factor);
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
if (self->mode == SHELL_BLUR_MODE_BACKGROUND)
|
|
|
|
updated = updated && update_background_fbo (self, width, height);
|
|
|
|
|
|
|
|
self->tex_width = width;
|
|
|
|
self->tex_height = height;
|
|
|
|
self->downscale_factor = downscale_factor;
|
|
|
|
|
|
|
|
return updated;
|
|
|
|
}
|
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
static void
|
|
|
|
add_actor_node (ShellBlurEffect *self,
|
|
|
|
ClutterPaintNode *node,
|
|
|
|
int opacity)
|
|
|
|
{
|
|
|
|
g_autoptr (ClutterPaintNode) actor_node = NULL;
|
|
|
|
|
|
|
|
actor_node = clutter_actor_node_new (self->actor, opacity);
|
|
|
|
clutter_paint_node_add_child (node, actor_node);
|
|
|
|
}
|
|
|
|
|
2020-01-07 14:34:03 -05:00
|
|
|
static void
|
|
|
|
paint_actor_offscreen (ShellBlurEffect *self,
|
2020-06-29 14:35:02 -04:00
|
|
|
ClutterPaintNode *node,
|
2020-01-07 14:34:03 -05:00
|
|
|
ClutterEffectPaintFlags flags)
|
|
|
|
{
|
|
|
|
gboolean actor_dirty;
|
|
|
|
|
|
|
|
actor_dirty = (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) != 0;
|
|
|
|
|
|
|
|
/* The actor offscreen framebuffer is updated already */
|
2020-06-29 14:35:02 -04:00
|
|
|
if (actor_dirty || !(self->cache_flags & ACTOR_PAINTED))
|
|
|
|
{
|
|
|
|
g_autoptr (ClutterPaintNode) transform_node = NULL;
|
|
|
|
g_autoptr (ClutterPaintNode) layer_node = NULL;
|
|
|
|
graphene_matrix_t transform;
|
|
|
|
|
|
|
|
/* Layer node */
|
|
|
|
layer_node = clutter_layer_node_new_to_framebuffer (self->actor_fb.framebuffer,
|
|
|
|
self->actor_fb.pipeline);
|
|
|
|
clutter_paint_node_set_static_name (layer_node, "ShellBlurEffect (actor offscreen)");
|
|
|
|
clutter_paint_node_add_child (node, layer_node);
|
|
|
|
clutter_paint_node_add_rectangle (layer_node,
|
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
self->tex_width / self->downscale_factor,
|
|
|
|
self->tex_height / self->downscale_factor,
|
|
|
|
});
|
|
|
|
|
|
|
|
/* Transform node */
|
|
|
|
graphene_matrix_init_scale (&transform,
|
|
|
|
1.f / self->downscale_factor,
|
|
|
|
1.f / self->downscale_factor,
|
|
|
|
1.f);
|
|
|
|
transform_node = clutter_transform_node_new (&transform);
|
|
|
|
clutter_paint_node_set_static_name (transform_node, "ShellBlurEffect (downscale)");
|
|
|
|
clutter_paint_node_add_child (layer_node, transform_node);
|
|
|
|
|
|
|
|
/* Actor node */
|
|
|
|
add_actor_node (self, transform_node, 255);
|
|
|
|
|
|
|
|
self->cache_flags |= ACTOR_PAINTED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_autoptr (ClutterPaintNode) pipeline_node = NULL;
|
|
|
|
|
|
|
|
pipeline_node = clutter_pipeline_node_new (self->actor_fb.pipeline);
|
|
|
|
clutter_paint_node_set_static_name (pipeline_node,
|
|
|
|
"ShellBlurEffect (actor texture)");
|
|
|
|
clutter_paint_node_add_child (node, pipeline_node);
|
|
|
|
clutter_paint_node_add_rectangle (pipeline_node,
|
|
|
|
&(ClutterActorBox) {
|
|
|
|
0.f, 0.f,
|
|
|
|
self->tex_width / self->downscale_factor,
|
|
|
|
self->tex_height / self->downscale_factor,
|
|
|
|
});
|
|
|
|
}
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
needs_repaint (ShellBlurEffect *self,
|
|
|
|
ClutterEffectPaintFlags flags)
|
|
|
|
{
|
|
|
|
gboolean actor_cached;
|
|
|
|
gboolean blur_cached;
|
|
|
|
gboolean actor_dirty;
|
|
|
|
|
|
|
|
actor_dirty = (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) != 0;
|
|
|
|
blur_cached = (self->cache_flags & BLUR_APPLIED) != 0;
|
|
|
|
actor_cached = (self->cache_flags & ACTOR_PAINTED) != 0;
|
|
|
|
|
|
|
|
switch (self->mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
|
|
|
return actor_dirty || !blur_cached || !actor_cached;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-06-29 14:35:02 -04:00
|
|
|
shell_blur_effect_paint_node (ClutterEffect *effect,
|
|
|
|
ClutterPaintNode *node,
|
|
|
|
ClutterPaintContext *paint_context,
|
|
|
|
ClutterEffectPaintFlags flags)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
ShellBlurEffect *self = SHELL_BLUR_EFFECT (effect);
|
2020-02-07 04:21:21 -05:00
|
|
|
uint8_t paint_opacity;
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-03-27 18:00:36 -04:00
|
|
|
g_assert (self->actor != NULL);
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
if (self->sigma > 0)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
2020-06-29 14:35:02 -04:00
|
|
|
g_autoptr (ClutterPaintNode) blur_node = NULL;
|
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
switch (self->mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
|
|
|
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
|
|
|
paint_opacity = 255;
|
|
|
|
break;
|
2021-01-26 15:25:47 -05:00
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
break;
|
2020-12-09 17:20:16 -05:00
|
|
|
}
|
|
|
|
|
2020-01-07 14:34:03 -05:00
|
|
|
if (needs_repaint (self, flags))
|
|
|
|
{
|
2020-02-12 17:02:14 -05:00
|
|
|
ClutterActorBox source_actor_box;
|
|
|
|
|
|
|
|
update_actor_box (self, paint_context, &source_actor_box);
|
|
|
|
|
2020-01-07 14:34:03 -05:00
|
|
|
/* Failing to create or update the offscreen framebuffers prevents
|
|
|
|
* the entire effect to be applied.
|
|
|
|
*/
|
2020-02-12 17:02:14 -05:00
|
|
|
if (!update_framebuffers (self, paint_context, &source_actor_box))
|
2020-01-07 14:34:03 -05:00
|
|
|
goto fail;
|
|
|
|
|
2020-12-09 17:20:16 -05:00
|
|
|
blur_node = create_blur_nodes (self, node, paint_opacity);
|
|
|
|
|
2020-01-07 14:34:03 -05:00
|
|
|
switch (self->mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
2020-06-29 14:35:02 -04:00
|
|
|
paint_actor_offscreen (self, blur_node, flags);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
2020-06-29 14:35:02 -04:00
|
|
|
paint_background (self, blur_node, paint_context, &source_actor_box);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-06-29 14:35:02 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Use the cached pipeline if no repaint is needed */
|
2020-12-09 17:20:16 -05:00
|
|
|
add_blurred_pipeline (self, node, paint_opacity);
|
2020-06-29 14:35:02 -04:00
|
|
|
}
|
2020-01-07 14:34:03 -05:00
|
|
|
|
|
|
|
/* Background blur needs to paint the actor after painting the blurred
|
|
|
|
* background.
|
|
|
|
*/
|
|
|
|
switch (self->mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
2020-06-29 14:35:02 -04:00
|
|
|
add_actor_node (self, node, -1);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fail:
|
|
|
|
/* When no blur is applied, or the offscreen framebuffers
|
|
|
|
* couldn't be created, fallback to simply painting the actor.
|
|
|
|
*/
|
2020-06-29 14:35:02 -04:00
|
|
|
add_actor_node (self, node, -1);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
ShellBlurEffect *self = (ShellBlurEffect *)object;
|
|
|
|
|
|
|
|
clear_framebuffer_data (&self->actor_fb);
|
|
|
|
clear_framebuffer_data (&self->background_fb);
|
|
|
|
clear_framebuffer_data (&self->brightness_fb);
|
|
|
|
|
|
|
|
g_clear_pointer (&self->actor_fb.pipeline, cogl_object_unref);
|
|
|
|
g_clear_pointer (&self->background_fb.pipeline, cogl_object_unref);
|
|
|
|
g_clear_pointer (&self->brightness_fb.pipeline, cogl_object_unref);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (shell_blur_effect_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ShellBlurEffect *self = SHELL_BLUR_EFFECT (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2020-02-10 09:34:57 -05:00
|
|
|
case PROP_SIGMA:
|
|
|
|
g_value_set_int (value, self->sigma);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_BRIGHTNESS:
|
2020-01-09 15:50:11 -05:00
|
|
|
g_value_set_float (value, self->brightness);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_MODE:
|
|
|
|
g_value_set_enum (value, self->mode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ShellBlurEffect *self = SHELL_BLUR_EFFECT (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2020-02-10 09:34:57 -05:00
|
|
|
case PROP_SIGMA:
|
|
|
|
shell_blur_effect_set_sigma (self, g_value_get_int (value));
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_BRIGHTNESS:
|
|
|
|
shell_blur_effect_set_brightness (self, g_value_get_float (value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_MODE:
|
|
|
|
shell_blur_effect_set_mode (self, g_value_get_enum (value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_class_init (ShellBlurEffectClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
|
|
|
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = shell_blur_effect_finalize;
|
|
|
|
object_class->get_property = shell_blur_effect_get_property;
|
|
|
|
object_class->set_property = shell_blur_effect_set_property;
|
|
|
|
|
|
|
|
meta_class->set_actor = shell_blur_effect_set_actor;
|
|
|
|
|
2020-06-29 14:35:02 -04:00
|
|
|
effect_class->paint_node = shell_blur_effect_paint_node;
|
2020-01-07 14:34:03 -05:00
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
properties[PROP_SIGMA] =
|
|
|
|
g_param_spec_int ("sigma",
|
|
|
|
"Sigma",
|
|
|
|
"Sigma",
|
2020-01-07 14:34:03 -05:00
|
|
|
0, G_MAXINT, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
properties[PROP_BRIGHTNESS] =
|
|
|
|
g_param_spec_float ("brightness",
|
|
|
|
"Brightness",
|
|
|
|
"Brightness",
|
|
|
|
0.f, 1.f, 1.f,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
properties[PROP_MODE] =
|
|
|
|
g_param_spec_enum ("mode",
|
|
|
|
"Blur mode",
|
|
|
|
"Blur mode",
|
|
|
|
SHELL_TYPE_BLUR_MODE,
|
|
|
|
SHELL_BLUR_MODE_ACTOR,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shell_blur_effect_init (ShellBlurEffect *self)
|
|
|
|
{
|
|
|
|
self->mode = SHELL_BLUR_MODE_ACTOR;
|
2020-02-10 09:34:57 -05:00
|
|
|
self->sigma = 0;
|
2020-01-07 14:34:03 -05:00
|
|
|
self->brightness = 1.f;
|
|
|
|
|
|
|
|
self->actor_fb.pipeline = create_base_pipeline ();
|
|
|
|
self->background_fb.pipeline = create_base_pipeline ();
|
|
|
|
self->brightness_fb.pipeline = create_brightness_pipeline ();
|
|
|
|
self->brightness_uniform =
|
|
|
|
cogl_pipeline_get_uniform_location (self->brightness_fb.pipeline, "brightness");
|
|
|
|
}
|
|
|
|
|
|
|
|
ShellBlurEffect *
|
|
|
|
shell_blur_effect_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (SHELL_TYPE_BLUR_EFFECT, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2020-02-10 09:34:57 -05:00
|
|
|
shell_blur_effect_get_sigma (ShellBlurEffect *self)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (SHELL_IS_BLUR_EFFECT (self), -1);
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
return self->sigma;
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-02-10 09:34:57 -05:00
|
|
|
shell_blur_effect_set_sigma (ShellBlurEffect *self,
|
|
|
|
int sigma)
|
2020-01-07 14:34:03 -05:00
|
|
|
{
|
|
|
|
g_return_if_fail (SHELL_IS_BLUR_EFFECT (self));
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
if (self->sigma == sigma)
|
2020-01-07 14:34:03 -05:00
|
|
|
return;
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
self->sigma = sigma;
|
2020-01-07 14:34:03 -05:00
|
|
|
self->cache_flags &= ~BLUR_APPLIED;
|
|
|
|
|
|
|
|
if (self->actor)
|
|
|
|
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
|
|
|
|
2020-02-10 09:34:57 -05:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SIGMA]);
|
2020-01-07 14:34:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
float
|
|
|
|
shell_blur_effect_get_brightness (ShellBlurEffect *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (SHELL_IS_BLUR_EFFECT (self), FALSE);
|
|
|
|
|
|
|
|
return self->brightness;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
shell_blur_effect_set_brightness (ShellBlurEffect *self,
|
|
|
|
float brightness)
|
|
|
|
{
|
|
|
|
g_return_if_fail (SHELL_IS_BLUR_EFFECT (self));
|
|
|
|
|
|
|
|
if (self->brightness == brightness)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self->brightness = brightness;
|
|
|
|
self->cache_flags &= ~BLUR_APPLIED;
|
|
|
|
|
|
|
|
if (self->actor)
|
|
|
|
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BRIGHTNESS]);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShellBlurMode
|
|
|
|
shell_blur_effect_get_mode (ShellBlurEffect *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (SHELL_IS_BLUR_EFFECT (self), -1);
|
|
|
|
|
|
|
|
return self->mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
shell_blur_effect_set_mode (ShellBlurEffect *self,
|
|
|
|
ShellBlurMode mode)
|
|
|
|
{
|
|
|
|
g_return_if_fail (SHELL_IS_BLUR_EFFECT (self));
|
|
|
|
|
|
|
|
if (self->mode == mode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self->mode = mode;
|
|
|
|
self->cache_flags &= ~BLUR_APPLIED;
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case SHELL_BLUR_MODE_ACTOR:
|
2020-02-13 07:08:28 -05:00
|
|
|
clear_framebuffer_data (&self->background_fb);
|
2020-01-07 14:34:03 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHELL_BLUR_MODE_BACKGROUND:
|
|
|
|
default:
|
|
|
|
/* Do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self->actor)
|
|
|
|
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODE]);
|
|
|
|
}
|