Skip to content

Commit 5c82521

Browse files
committed
Don't scale BackgroundBlurEffect
1 parent abf0769 commit 5c82521

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

src/BackgroundBlurEffect.vala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
*/
55

66
public class Gala.BackgroundBlurEffect : Clutter.Effect {
7-
/**
8-
* Our rounded corners effect is antialiased, so we need to add a small offset to have proper corners
9-
*/
10-
private const int CLIP_RADIUS_OFFSET = 2;
117
private const float MIN_DOWNSCALE_SIZE = 256.0f;
128
private const float MAX_RADIUS = 12.0f;
139
private const int FORCE_REFRESH_FRAMES = 2;
@@ -72,8 +68,8 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
7268
uniform float clip_radius;
7369
7470
float rounded_rect_coverage (vec2 p) {
75-
float center_left = clip_radius + 1.5;
76-
float center_right = actor_size.x - clip_radius - 0.55;
71+
float center_left = clip_radius;
72+
float center_right = actor_size.x - clip_radius;
7773
7874
float center_x;
7975
if (p.x < center_left) {
@@ -84,8 +80,8 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
8480
return 1.0;
8581
}
8682
87-
float center_top = clip_radius + 1.5;
88-
float center_bottom = actor_size.y - clip_radius - 0.55;
83+
float center_top = clip_radius;
84+
float center_bottom = actor_size.y - clip_radius;
8985
9086
float center_y;
9187
if (p.y < center_top) {
@@ -111,7 +107,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
111107
return 1.0;
112108
}
113109
// Only pixels on the edge of the curve need expensive antialiasing
114-
return outer_radius - sqrt (dist_squared);
110+
return smoothstep (outer_radius, inner_radius, sqrt (dist_squared));
115111
}
116112
""",
117113

@@ -149,7 +145,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
149145
}
150146

151147
private void update_clip_radius () {
152-
float[] _clip_radius = { clip_radius * monitor_scale + CLIP_RADIUS_OFFSET };
148+
float[] _clip_radius = { clip_radius * monitor_scale };
153149
round_pipeline.set_uniform_float (round_clip_radius_location, 1, 1, _clip_radius);
154150
}
155151

src/BlurManager.vala

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public class Gala.BlurManager : Object {
4343
window.notify["mutter-hints"].connect ((obj, pspec) => parse_mutter_hints ((Meta.Window) obj));
4444
parse_mutter_hints (window);
4545
});
46-
47-
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
48-
monitor_manager.monitors_changed.connect (update_monitors);
4946
}
5047

5148
/**
@@ -58,11 +55,9 @@ public class Gala.BlurManager : Object {
5855
return;
5956
}
6057

61-
var monitor_scaling_factor = wm.get_display ().get_monitor_scale (window.get_monitor ());
62-
6358
var blur_data = blurred_windows[window];
6459
if (blur_data == null) {
65-
var blur_effect = new BackgroundBlurEffect (BLUR_RADIUS, clip_radius, monitor_scaling_factor);
60+
var blur_effect = new BackgroundBlurEffect (BLUR_RADIUS, (int) clip_radius, 1.0f);
6661

6762
var blurred_actor = new Clutter.Actor ();
6863
blurred_actor.add_effect (blur_effect);
@@ -76,12 +71,11 @@ public class Gala.BlurManager : Object {
7671

7772
var buffer_rect = window.get_buffer_rect ();
7873
var frame_rect = window.get_frame_rect ();
79-
var x_shadow_size = (frame_rect.x - buffer_rect.x) / monitor_scaling_factor;
80-
var y_shadow_size = (frame_rect.y - buffer_rect.y) / monitor_scaling_factor;
74+
var x_shadow_size = frame_rect.x - buffer_rect.x;
75+
var y_shadow_size = frame_rect.y - buffer_rect.y;
8176

8277
blur_data.actor.set_position (x_shadow_size + left, y_shadow_size + top);
8378
blur_data.actor.set_size (frame_rect.width - left - right, frame_rect.height - top - bottom);
84-
blur_data.blur_effect.monitor_scale = monitor_scaling_factor;
8579
}
8680

8781
public void remove_blur (Meta.Window window) {
@@ -110,15 +104,6 @@ public class Gala.BlurManager : Object {
110104
add_blur (window, blur_data.left, blur_data.right, blur_data.top, blur_data.bottom, blur_data.clip_radius);
111105
}
112106

113-
private void update_monitors () {
114-
foreach (unowned var window in blurred_windows.get_keys ()) {
115-
var blur_data = blurred_windows[window];
116-
117-
var monitor_scaling_factor = window.display.get_monitor_scale (window.get_monitor ());
118-
blur_data.blur_effect.monitor_scale = monitor_scaling_factor;
119-
}
120-
}
121-
122107
//X11 only
123108
private void parse_mutter_hints (Meta.Window window) {
124109
if (window.mutter_hints == null) {

0 commit comments

Comments
 (0)