@@ -65,7 +65,7 @@ static void apps_circletext_start(twin_screen_t *screen,
65
65
twin_path_utf8 (path , "Hello, world!" );
66
66
twin_path_restore (path , & state );
67
67
}
68
- twin_fill_path (alpha , path , 0 , 0 );
68
+ twin_paint_path (alpha , 0xff000000 , path );
69
69
twin_path_destroy (path );
70
70
twin_path_destroy (pen );
71
71
source .source_kind = TWIN_SOLID ;
@@ -112,7 +112,7 @@ static void apps_quickbrown_start(twin_screen_t *screen,
112
112
fy += D (s );
113
113
}
114
114
115
- twin_fill_path (alpha , path , 0 , 0 );
115
+ twin_paint_path (alpha , 0xff000000 , path );
116
116
twin_path_destroy (path );
117
117
twin_path_destroy (pen );
118
118
source .source_kind = TWIN_SOLID ;
@@ -160,7 +160,7 @@ static void apps_ascii_start(twin_screen_t *screen, int x, int y, int w, int h)
160
160
fy += D (s + 2 );
161
161
}
162
162
163
- twin_fill_path (alpha , path , 0 , 0 );
163
+ twin_paint_path (alpha , 0xff000000 , path );
164
164
twin_path_destroy (path );
165
165
twin_path_destroy (pen );
166
166
source .source_kind = TWIN_SOLID ;
@@ -285,15 +285,15 @@ static void apps_blur(twin_screen_t *screen, int x, int y, int w, int h)
285
285
twin_window_t * window = twin_window_create (
286
286
screen , TWIN_ARGB32 , TwinWindowApplication , x , y , w , h );
287
287
twin_window_set_name (window , "Blur" );
288
- twin_pixmap_t * scaled_background = twin_pixmap_create (
289
- TWIN_ARGB32 , window -> pixmap -> width , window -> pixmap -> height );
288
+ int client_width = window -> client .right - window -> client .left ;
289
+ int client_height = window -> client .bottom - window -> client .top ;
290
+ twin_pixmap_t * scaled_background =
291
+ twin_pixmap_create (TWIN_ARGB32 , client_width , client_height );
290
292
twin_fixed_t sx , sy ;
291
- sx = twin_fixed_div (
292
- twin_int_to_fixed (raw_background -> width ),
293
- twin_int_to_fixed (window -> client .right - window -> client .left ));
294
- sy = twin_fixed_div (
295
- twin_int_to_fixed (raw_background -> height ),
296
- twin_int_to_fixed (window -> client .bottom - window -> client .top ));
293
+ sx = twin_fixed_div (twin_int_to_fixed (raw_background -> width ),
294
+ twin_int_to_fixed (client_width ));
295
+ sy = twin_fixed_div (twin_int_to_fixed (raw_background -> height ),
296
+ twin_int_to_fixed (client_height ));
297
297
298
298
twin_matrix_scale (& raw_background -> transform , sx , sy );
299
299
twin_operand_t srcop = {
@@ -304,18 +304,15 @@ static void apps_blur(twin_screen_t *screen, int x, int y, int w, int h)
304
304
twin_composite (scaled_background , 0 , 0 , & srcop , 0 , 0 , 0 , 0 , 0 , TWIN_SOURCE ,
305
305
scaled_background -> width , scaled_background -> height );
306
306
307
- twin_pointer_t src , dst ;
308
- for (int y = window -> client .top ; y < window -> client .bottom ; y ++ )
309
- for (int x = window -> client .left ; x < window -> client .right ; x ++ ) {
310
- src =
311
- twin_pixmap_pointer (scaled_background , x - window -> client .left ,
312
- y - window -> client .top );
313
- dst = twin_pixmap_pointer (window -> pixmap , x , y );
314
- * dst .argb32 = * src .argb32 | 0xff000000 ;
315
- }
316
- twin_stack_blur (window -> pixmap , 5 , window -> client .left ,
317
- window -> client .right , window -> client .top ,
318
- window -> client .bottom );
307
+ /* Apply blur effect to the scaled background */
308
+ twin_stack_blur (scaled_background , 16 , 0 , scaled_background -> width - 1 , 0 ,
309
+ scaled_background -> height - 1 );
310
+
311
+ /* Copy the blurred background to the window */
312
+ srcop .u .pixmap = scaled_background ;
313
+ twin_composite (window -> pixmap , window -> client .left , window -> client .top ,
314
+ & srcop , 0 , 0 , NULL , 0 , 0 , TWIN_SOURCE , client_width ,
315
+ client_height );
319
316
320
317
twin_pixmap_destroy (scaled_background );
321
318
twin_pixmap_destroy (raw_background );
0 commit comments