fixup! screenShield: Blur background
This commit is contained in:
parent
e71c249ea5
commit
be714f7401
@ -28,7 +28,7 @@ const DISABLE_LOCK_KEY = 'disable-lock-screen';
|
|||||||
const LOCKED_STATE_STR = 'screenShield.locked';
|
const LOCKED_STATE_STR = 'screenShield.locked';
|
||||||
|
|
||||||
const BLUR_BRIGHTNESS = 0.55;
|
const BLUR_BRIGHTNESS = 0.55;
|
||||||
const BLUR_RADIUS = 70;
|
const BLUR_RADIUS = 200;
|
||||||
|
|
||||||
// fraction of screen height the arrow must reach before completing
|
// fraction of screen height the arrow must reach before completing
|
||||||
// the slide up automatically
|
// the slide up automatically
|
||||||
|
@ -62,7 +62,7 @@ static const gchar *gaussian_blur_glsl =
|
|||||||
" cogl_texel = vec4 (ret / total); \n"
|
" cogl_texel = vec4 (ret / total); \n"
|
||||||
" cogl_texel.rgb *= brightness; \n";
|
" cogl_texel.rgb *= brightness; \n";
|
||||||
|
|
||||||
#define DOWNSCALE_FACTOR 3.0
|
#define DOWNSCALE_FACTOR 4.0
|
||||||
|
|
||||||
struct _ShellBlurEffect
|
struct _ShellBlurEffect
|
||||||
{
|
{
|
||||||
@ -127,19 +127,21 @@ create_pipeline (void)
|
|||||||
return cogl_pipeline_copy (base_pipeline);
|
return cogl_pipeline_copy (base_pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
shell_blur_effect_pre_paint (ClutterEffect *effect)
|
queue_actor_repaint (ShellBlurEffect *self)
|
||||||
|
{
|
||||||
|
ClutterActor *actor =
|
||||||
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
|
||||||
|
|
||||||
|
if (actor)
|
||||||
|
clutter_actor_queue_redraw (actor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_uniforms (ShellBlurEffect *self)
|
||||||
{
|
{
|
||||||
ShellBlurEffect *self = SHELL_BLUR_EFFECT (effect);
|
|
||||||
ClutterOffscreenEffect *offscreen_effect =
|
ClutterOffscreenEffect *offscreen_effect =
|
||||||
CLUTTER_OFFSCREEN_EFFECT (self);
|
CLUTTER_OFFSCREEN_EFFECT (self);
|
||||||
gboolean success;
|
|
||||||
|
|
||||||
success = CLUTTER_EFFECT_CLASS (shell_blur_effect_parent_class)->pre_paint (effect);
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
CoglFramebuffer *offscreen;
|
|
||||||
CoglHandle texture;
|
CoglHandle texture;
|
||||||
|
|
||||||
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
|
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
|
||||||
@ -153,6 +155,7 @@ shell_blur_effect_pre_paint (ClutterEffect *effect)
|
|||||||
|
|
||||||
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (self),
|
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (self),
|
||||||
&rect);
|
&rect);
|
||||||
|
|
||||||
if (self->vertical)
|
if (self->vertical)
|
||||||
pixel_step = 1.f / rect.size.height;
|
pixel_step = 1.f / rect.size.height;
|
||||||
else
|
else
|
||||||
@ -185,13 +188,24 @@ shell_blur_effect_pre_paint (ClutterEffect *effect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
shell_blur_effect_pre_paint (ClutterEffect *effect)
|
||||||
|
{
|
||||||
|
gboolean success;
|
||||||
|
|
||||||
|
success = CLUTTER_EFFECT_CLASS (shell_blur_effect_parent_class)->pre_paint (effect);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
CoglFramebuffer *offscreen = cogl_get_draw_framebuffer ();
|
||||||
|
|
||||||
/* Texture is downscaled, draw downscaled as well */
|
/* Texture is downscaled, draw downscaled as well */
|
||||||
offscreen = cogl_get_draw_framebuffer ();
|
|
||||||
cogl_framebuffer_scale (offscreen,
|
cogl_framebuffer_scale (offscreen,
|
||||||
1.0 / DOWNSCALE_FACTOR,
|
1.0 / DOWNSCALE_FACTOR,
|
||||||
1.0 / DOWNSCALE_FACTOR,
|
1.0 / DOWNSCALE_FACTOR,
|
||||||
0.0);
|
1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
@ -207,6 +221,8 @@ shell_blur_effect_paint_target (ClutterOffscreenEffect *effect)
|
|||||||
float blur_radius_offset_v;
|
float blur_radius_offset_v;
|
||||||
guint8 paint_opacity;
|
guint8 paint_opacity;
|
||||||
|
|
||||||
|
update_uniforms (self);
|
||||||
|
|
||||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
|
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
|
||||||
paint_opacity = clutter_actor_get_paint_opacity (actor);
|
paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||||
|
|
||||||
@ -240,7 +256,7 @@ shell_blur_effect_post_paint (ClutterEffect *effect)
|
|||||||
cogl_framebuffer_scale (offscreen,
|
cogl_framebuffer_scale (offscreen,
|
||||||
DOWNSCALE_FACTOR,
|
DOWNSCALE_FACTOR,
|
||||||
DOWNSCALE_FACTOR,
|
DOWNSCALE_FACTOR,
|
||||||
0.f);
|
1.f);
|
||||||
|
|
||||||
CLUTTER_EFFECT_CLASS (shell_blur_effect_parent_class)->post_paint (effect);
|
CLUTTER_EFFECT_CLASS (shell_blur_effect_parent_class)->post_paint (effect);
|
||||||
}
|
}
|
||||||
@ -253,7 +269,9 @@ shell_blur_effect_create_texture (ClutterOffscreenEffect *effect,
|
|||||||
CoglContext *ctx =
|
CoglContext *ctx =
|
||||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
|
||||||
return cogl_texture_2d_new_with_size (ctx, width / 2.0, height / 2.0);
|
return cogl_texture_2d_new_with_size (ctx,
|
||||||
|
width / DOWNSCALE_FACTOR,
|
||||||
|
height / DOWNSCALE_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -436,7 +454,7 @@ shell_blur_effect_set_blur_radius (ShellBlurEffect *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self->blur_radius = radius;
|
self->blur_radius = radius;
|
||||||
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
queue_actor_repaint (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BLUR_RADIUS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BLUR_RADIUS]);
|
||||||
}
|
}
|
||||||
@ -459,7 +477,7 @@ shell_blur_effect_set_brightness (ShellBlurEffect *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self->brightness = brightness;
|
self->brightness = brightness;
|
||||||
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
queue_actor_repaint (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BRIGHTNESS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BRIGHTNESS]);
|
||||||
}
|
}
|
||||||
@ -482,7 +500,7 @@ shell_blur_effect_set_vertical (ShellBlurEffect *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self->vertical = vertical;
|
self->vertical = vertical;
|
||||||
clutter_effect_queue_repaint (CLUTTER_EFFECT (self));
|
queue_actor_repaint (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VERTICAL]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VERTICAL]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user