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

Commit b36db1c

Browse files
author
Jonah Williams
authored
[Impeller] Dont copy the paint until we're sure that the RRect blur optimization 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%
1 parent be9e2c4 commit b36db1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

impeller/aiks/canvas.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,18 @@ void Canvas::DrawPaint(const Paint& paint) {
193193
bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
194194
Scalar corner_radius,
195195
const Paint& paint) {
196-
Paint new_paint = paint;
197-
if (new_paint.color_source.GetType() != ColorSource::Type::kColor ||
198-
new_paint.style != Paint::Style::kFill) {
196+
if (paint.color_source.GetType() != ColorSource::Type::kColor ||
197+
paint.style != Paint::Style::kFill) {
199198
return false;
200199
}
201200

202-
if (!new_paint.mask_blur_descriptor.has_value() ||
203-
new_paint.mask_blur_descriptor->style !=
204-
FilterContents::BlurStyle::kNormal) {
201+
if (!paint.mask_blur_descriptor.has_value() ||
202+
paint.mask_blur_descriptor->style != FilterContents::BlurStyle::kNormal) {
205203
return false;
206204
}
207205

206+
Paint new_paint = paint;
207+
208208
// For symmetrically mask blurred solid RRects, absorb the mask blur and use
209209
// a faster SDF approximation.
210210

0 commit comments

Comments
 (0)