Skip to content

Commit 93ab23d

Browse files
authored
ShadowEffect: fix scale (#2381)
1 parent 102f98c commit 93ab23d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/ShadowEffect.vala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public class Gala.ShadowEffect : Clutter.Effect {
8383
}
8484
}
8585

86-
private Cogl.Texture? get_shadow (Cogl.Context context, int width, int height, int shadow_size) {
86+
private Cogl.Texture? get_shadow (Cogl.Context context, int width, int height, int shadow_size, int border_radius) {
8787
var old_key = current_key;
88-
current_key = "%ix%i:%i".printf (width, height, shadow_size);
88+
current_key = "%ix%i:%i:%i".printf (width, height, shadow_size, border_radius);
8989
if (old_key == current_key) {
9090
return null;
9191
}
@@ -123,8 +123,7 @@ public class Gala.ShadowEffect : Clutter.Effect {
123123

124124
cr.save ();
125125
cr.set_operator (Cairo.Operator.CLEAR);
126-
var size = shadow_size * monitor_scale;
127-
Drawing.Utilities.cairo_rounded_rectangle (cr, size, size, actor.width, actor.height, border_radius);
126+
Drawing.Utilities.cairo_rounded_rectangle (cr, shadow_size, shadow_size, actor.width, actor.height, border_radius);
128127
cr.fill ();
129128
cr.restore ();
130129

@@ -145,7 +144,7 @@ public class Gala.ShadowEffect : Clutter.Effect {
145144
var width = (int) (bounding_box.x2 - bounding_box.x1);
146145
var height = (int) (bounding_box.y2 - bounding_box.y1);
147146

148-
var shadow = get_shadow (context.get_framebuffer ().get_context (), width, height, shadow_size);
147+
var shadow = get_shadow (context.get_framebuffer ().get_context (), width, height, Utils.scale_to_int (shadow_size, monitor_scale), Utils.scale_to_int (border_radius, monitor_scale));
149148
if (shadow != null) {
150149
pipeline.set_layer_texture (0, shadow);
151150
}
@@ -162,9 +161,9 @@ public class Gala.ShadowEffect : Clutter.Effect {
162161
}
163162

164163
private Clutter.ActorBox get_bounding_box () {
165-
var size = shadow_size * monitor_scale;
166-
var bounding_box = Clutter.ActorBox ();
164+
var size = Utils.scale_to_int (shadow_size, monitor_scale);
167165

166+
var bounding_box = Clutter.ActorBox ();
168167
bounding_box.set_origin (-size, -size);
169168
bounding_box.set_size (actor.width + size * 2, actor.height + size * 2);
170169

0 commit comments

Comments
 (0)