File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -234,11 +234,13 @@ public class Gala.ShadowEffect : Clutter.Effect {
234234 var current_row_end = current_row + width - 1 ;
235235 var end_row = (height - 1 - y) * width;
236236 var end_row_end = end_row + width - 1 ;
237+
238+ var dy = target_square - y;
239+ var dy_squared = dy * dy;
240+
237241 for (var x = 0 ; x < target_square; x++ ) {
238242 var dx = target_square - x;
239- var dy = target_square - y;
240-
241- var squared_distance = dx * dx + dy * dy;
243+ var squared_distance = dx * dx + dy_squared;
242244
243245 if (squared_distance > target_square * target_square) {
244246 continue ;
@@ -251,10 +253,8 @@ public class Gala.ShadowEffect : Clutter.Effect {
251253 var real_dx = dx - corner_radius * cos;
252254 var real_dy = dy - corner_radius * sin;
253255
254- var real_distance = Math . sqrt (real_dx * real_dx + real_dy * real_dy);
255-
256256 // use fast Gaussian blur approximation
257- var normalized = (double ) real_distance / shadow_size;
257+ var normalized = (double ) Math . sqrt (real_dx * real_dx + real_dy * real_dy) / shadow_size;
258258 var current_color = (uint8 ) (1.0 - normalized * normalized * (3.0 - 2.0 * normalized) * 255.0 );
259259
260260 // when we're very close to the rounded corner, our real_distance can be wrong (idk why).
You can’t perform that action at this time.
0 commit comments