[gnome-shell/gnome-3-36] blur-effect: Don't use stage view when drawing off-stage
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-36] blur-effect: Don't use stage view when drawing off-stage
- Date: Mon, 15 Feb 2021 12:40:35 +0000 (UTC)
commit 1109968ae7f1db96c864c46755d36be4b73d49bf
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sat Feb 13 16:07:22 2021 +0100
blur-effect: Don't use stage view when drawing off-stage
When we're painting off-stage, for example because we're screencasting
or taking a screenshot, there won't be a stage-view associated with the
paint context. The BlurEffect previously didn't handle that case and
would crash.
Fix that and handle that case by assuming the scale is 1 and not
offsetting the rectangle we blit from the draw framebuffer.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1673>
(cherry picked from commit 09602ae2aee963710bd1cbbf7102fc1632d4e0df)
src/shell-blur-effect.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/shell-blur-effect.c b/src/shell-blur-effect.c
index 5e50ab886f..6c7c32fee5 100644
--- a/src/shell-blur-effect.c
+++ b/src/shell-blur-effect.c
@@ -531,7 +531,6 @@ update_actor_box (ShellBlurEffect *self,
float box_scale_factor = 1.0f;
float origin_x, origin_y;
float width, height;
- cairo_rectangle_int_t stage_view_layout;
switch (self->mode)
{
@@ -541,14 +540,26 @@ update_actor_box (ShellBlurEffect *self,
case SHELL_BLUR_MODE_BACKGROUND:
stage_view = clutter_paint_context_get_stage_view (paint_context);
- box_scale_factor = clutter_stage_view_get_scale (stage_view);
- clutter_stage_view_get_layout (stage_view, &stage_view_layout);
clutter_actor_get_transformed_position (self->actor, &origin_x, &origin_y);
clutter_actor_get_transformed_size (self->actor, &width, &height);
- origin_x -= stage_view_layout.x;
- origin_y -= stage_view_layout.y;
+ 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.
+ */
+ }
clutter_actor_box_set_origin (source_actor_box, origin_x, origin_y);
clutter_actor_box_set_size (source_actor_box, width, height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]