Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
[Impeller] Dont copy the paint until we're sure that the RRect blur o…
Browse files Browse the repository at this point in the history
…ptimization will apply. (#48298)

Extremely minor micro optimization. Dont copy the paint too early.

Before

![image](https://github.com/flutter/engine/assets/8975114/b5884e02-25ed-4e53-a6e0-d8d5a6a9a79a)

13/269 = ~5%

After:

![image](https://github.com/flutter/engine/assets/8975114/ac5981bb-40c6-4a38-b24c-46b7ad5399a4)

3/262 = ~1%
  • Loading branch information
jonahwilliams authored Nov 22, 2023
1 parent be9e2c4 commit b36db1c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,18 @@ void Canvas::DrawPaint(const Paint& paint) {
bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
Scalar corner_radius,
const Paint& paint) {
Paint new_paint = paint;
if (new_paint.color_source.GetType() != ColorSource::Type::kColor ||
new_paint.style != Paint::Style::kFill) {
if (paint.color_source.GetType() != ColorSource::Type::kColor ||
paint.style != Paint::Style::kFill) {
return false;
}

if (!new_paint.mask_blur_descriptor.has_value() ||
new_paint.mask_blur_descriptor->style !=
FilterContents::BlurStyle::kNormal) {
if (!paint.mask_blur_descriptor.has_value() ||
paint.mask_blur_descriptor->style != FilterContents::BlurStyle::kNormal) {
return false;
}

Paint new_paint = paint;

// For symmetrically mask blurred solid RRects, absorb the mask blur and use
// a faster SDF approximation.

Expand Down

0 comments on commit b36db1c

Please sign in to comment.