@@ -10,7 +10,6 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
1010
1111 public float blur_radius { get ; construct; }
1212 public float clip_radius { get ; construct; }
13- public float monitor_scale { get ; construct set ; }
1413
1514 public uint left { get ; set ; default = 0 ; }
1615 public uint right { get ; set ; default = 0 ; }
@@ -36,8 +35,8 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
3635
3736 private int frame_counter = 0 ;
3837
39- public BackgroundBlurEffect (float blur_radius, float clip_radius, float monitor_scale ) {
40- Object (blur_radius: blur_radius, clip_radius: clip_radius, monitor_scale : monitor_scale );
38+ public BackgroundBlurEffect (float blur_radius , float clip_radius ) {
39+ Object (blur_radius: blur_radius, clip_radius: clip_radius);
4140 }
4241
4342 construct {
@@ -126,28 +125,27 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
126125 round_actor_size_location = round_pipeline. get_uniform_location (" actor_size" );
127126 }
128127
129- private void update_actor_box (Clutter . PaintContext paint_context, ref Clutter . ActorBox source_actor_box) {
130- float box_scale_factor = 1.0f ;
131- float origin_x, origin_y;
132- float width, height;
128+ private float get_stage_view_scale (Clutter .PaintContext paint_context ) {
129+ unowned var stage_view = paint_context. get_stage_view ();
133130
134- var stage_view = paint_context. get_stage_view ();
131+ return stage_view != null ? stage_view. scale : 1.0f ;
132+ }
135133
134+ private void update_actor_box (Clutter .PaintContext paint_context , ref Clutter .ActorBox source_actor_box ) {
135+ float origin_x, origin_y, width, height;
136136 actor. get_transformed_position (out origin_x, out origin_y);
137137 actor. get_transformed_size (out width, out height);
138+
139+ float box_scale_factor = get_stage_view_scale (paint_context);
140+ var stage_view = paint_context. get_stage_view ();
138141
139142 if (stage_view != null ) {
140143 Mtk . Rectangle stage_view_layout = {};
141144
142- box_scale_factor = stage_view. get_scale ();
143145 stage_view. get_layout (ref stage_view_layout);
144146
145147 origin_x - = stage_view_layout. x;
146148 origin_y - = stage_view_layout. y;
147- } else {
148- /* If we're drawing off stage, just assume scale = 1, this won't work
149- * with stage-view scaling though.
150- */
151149 }
152150
153151 source_actor_box. set_origin (origin_x, origin_y);
@@ -395,7 +393,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
395393 }
396394
397395 var relative_opacity = (float ) actor. opacity / 255.0f ;
398- real_blur_radius = blur_radius * (float ) Math . pow (relative_opacity, 2 ) * monitor_scale * (float ) total_scale;
396+ real_blur_radius = blur_radius * (float ) Math . pow (relative_opacity, 2 ) * get_stage_view_scale (paint_context) * (float ) total_scale;
399397
400398 Clutter . ActorBox source_actor_box = {};
401399 update_actor_box (paint_context, ref source_actor_box);
@@ -412,18 +410,18 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
412410 paint_background (blur_node, paint_context, source_actor_box);
413411 add_actor_node (node);
414412
415- update_uniforms ();
413+ update_uniforms (paint_context );
416414 }
417415
418- private void update_uniforms () requires (round_texture != null ) {
416+ private void update_uniforms (Clutter . PaintContext paint_context ) requires (round_texture != null ) {
419417 float [] actor_size = {
420418 round_texture. get_width (),
421419 round_texture. get_height ()
422420 };
423421 round_pipeline. set_uniform_float (round_actor_size_location, 2 , 1 , actor_size);
424422
425423 float [] clip_vals = {
426- (clip_radius * monitor_scale ) / downscale_factor
424+ (clip_radius * get_stage_view_scale (paint_context) ) / downscale_factor
427425 };
428426 round_pipeline. set_uniform_float (round_clip_radius_location, 1 , 1 , clip_vals);
429427 }
0 commit comments