[Impeller] Dont copy the paint until we're sure that the RRect blur optimization will apply. (flutter/engine#48298)
Extremely minor micro optimization. Dont copy the paint too early. Before  13/269 = ~5% After:  3/262 = ~1%
This commit is contained in:
@@ -193,18 +193,18 @@ void Canvas::DrawPaint(const Paint& paint) {
|
|||||||
bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
|
bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
|
||||||
Scalar corner_radius,
|
Scalar corner_radius,
|
||||||
const Paint& paint) {
|
const Paint& paint) {
|
||||||
Paint new_paint = paint;
|
if (paint.color_source.GetType() != ColorSource::Type::kColor ||
|
||||||
if (new_paint.color_source.GetType() != ColorSource::Type::kColor ||
|
paint.style != Paint::Style::kFill) {
|
||||||
new_paint.style != Paint::Style::kFill) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_paint.mask_blur_descriptor.has_value() ||
|
if (!paint.mask_blur_descriptor.has_value() ||
|
||||||
new_paint.mask_blur_descriptor->style !=
|
paint.mask_blur_descriptor->style != FilterContents::BlurStyle::kNormal) {
|
||||||
FilterContents::BlurStyle::kNormal) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Paint new_paint = paint;
|
||||||
|
|
||||||
// For symmetrically mask blurred solid RRects, absorb the mask blur and use
|
// For symmetrically mask blurred solid RRects, absorb the mask blur and use
|
||||||
// a faster SDF approximation.
|
// a faster SDF approximation.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user