mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[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:
parent
d5b171165f
commit
330c06a4f2
@ -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.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user