@@ -327,15 +327,13 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
327
327
// For symmetrically mask blurred solid RRects, absorb the mask blur and use
328
328
// a faster SDF approximation.
329
329
330
- Paint rrect_paint = paint;
330
+ Color rrect_color =
331
+ paint.HasColorFilter ()
332
+ // Absorb the color filter, if any.
333
+ ? paint.GetColorFilter ()->GetCPUColorFilterProc ()(paint.color )
334
+ : paint.color ;
331
335
332
- // Absorb the color filter, if any.
333
- if (rrect_paint.HasColorFilter ()) {
334
- rrect_paint.color =
335
- rrect_paint.GetColorFilter ()->GetCPUColorFilterProc ()(paint.color );
336
- rrect_paint.color_filter = nullptr ;
337
- rrect_paint.invert_colors = false ;
338
- }
336
+ Paint rrect_paint = {.mask_blur_descriptor = paint.mask_blur_descriptor };
339
337
340
338
// In some cases, we need to render the mask blur to a separate layer.
341
339
//
@@ -356,21 +354,21 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
356
354
// don't need to worry about the blend mode or translucency (unlike with
357
355
// BlurStyle::kSolid).
358
356
//
359
- if ((rrect_paint .mask_blur_descriptor ->style !=
357
+ if ((paint .mask_blur_descriptor ->style !=
360
358
FilterContents::BlurStyle::kNormal &&
361
- rrect_paint.image_filter ) ||
362
- (rrect_paint.mask_blur_descriptor ->style ==
363
- FilterContents::BlurStyle::kSolid &&
364
- (!rrect_paint.color .IsOpaque () ||
365
- rrect_paint.blend_mode != BlendMode::kSourceOver ))) {
359
+ paint.image_filter ) ||
360
+ (paint.mask_blur_descriptor ->style == FilterContents::BlurStyle::kSolid &&
361
+ (!rrect_color.IsOpaque () ||
362
+ paint.blend_mode != BlendMode::kSourceOver ))) {
366
363
// Defer the alpha, blend mode, and image filter to a separate layer.
367
- SaveLayer ({.color = Color::White ().WithAlpha (rrect_paint.color .alpha ),
368
- .blend_mode = rrect_paint.blend_mode ,
369
- .image_filter = rrect_paint.image_filter });
370
- rrect_paint.color = rrect_paint.color .WithAlpha (1 );
371
- rrect_paint.blend_mode = BlendMode::kSourceOver ;
372
- rrect_paint.image_filter = nullptr ;
364
+ SaveLayer ({.color = Color::White ().WithAlpha (rrect_color.alpha ),
365
+ .blend_mode = paint.blend_mode ,
366
+ .image_filter = paint.image_filter });
367
+ rrect_paint.color = rrect_color.WithAlpha (1 );
373
368
} else {
369
+ rrect_paint.color = rrect_color;
370
+ rrect_paint.blend_mode = paint.blend_mode ;
371
+ rrect_paint.image_filter = paint.image_filter ;
374
372
Save ();
375
373
}
376
374
0 commit comments