Reenable circle blur fast path for ellipse that transforms to circle
Bug: chromium:1132617 Change-Id: Id9ecc22dfd1720195e0753cfc2b0897fe09dc2ae Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327378 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
fd74ac6498
commit
1131b659f6
@ -713,21 +713,33 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> fp;
|
||||
|
||||
SkRRect devRRect;
|
||||
bool devRRectIsValid = srcRRect.transform(viewMatrix, &devRRect);
|
||||
|
||||
bool devRRectIsCircle = devRRectIsValid && SkRRectPriv::IsCircle(devRRect);
|
||||
|
||||
bool canBeRect = srcRRect.isRect() && viewMatrix.preservesRightAngles();
|
||||
bool canBeCircle = SkRRectPriv::IsCircle(srcRRect) && viewMatrix.isSimilarity();
|
||||
bool canBeCircle = (SkRRectPriv::IsCircle(srcRRect) && viewMatrix.isSimilarity()) ||
|
||||
devRRectIsCircle;
|
||||
|
||||
if (canBeRect || canBeCircle) {
|
||||
if (canBeRect) {
|
||||
fp = GrRectBlurEffect::Make(
|
||||
/*inputFP=*/nullptr, context, *context->priv().caps()->shaderCaps(),
|
||||
srcRRect.rect(), viewMatrix, xformedSigma);
|
||||
} else {
|
||||
SkPoint center = {srcRRect.getBounds().centerX(), srcRRect.getBounds().centerY()};
|
||||
viewMatrix.mapPoints(¢er, 1);
|
||||
SkScalar radius = viewMatrix.mapVector(0, srcRRect.width()/2.f).length();
|
||||
SkRect devBounds = {center.x() - radius,
|
||||
center.y() - radius,
|
||||
center.x() + radius,
|
||||
center.y() + radius};
|
||||
SkRect devBounds;
|
||||
if (devRRectIsCircle) {
|
||||
devBounds = devRRect.getBounds();
|
||||
} else {
|
||||
SkPoint center = {srcRRect.getBounds().centerX(), srcRRect.getBounds().centerY()};
|
||||
viewMatrix.mapPoints(¢er, 1);
|
||||
SkScalar radius = viewMatrix.mapVector(0, srcRRect.width()/2.f).length();
|
||||
devBounds = {center.x() - radius,
|
||||
center.y() - radius,
|
||||
center.x() + radius,
|
||||
center.y() + radius};
|
||||
}
|
||||
fp = GrCircleBlurFragmentProcessor::Make(/*inputFP=*/nullptr, context, devBounds,
|
||||
xformedSigma);
|
||||
}
|
||||
@ -760,8 +772,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
|
||||
if (!viewMatrix.isScaleTranslate()) {
|
||||
return false;
|
||||
}
|
||||
SkRRect devRRect;
|
||||
if (!srcRRect.transform(viewMatrix, &devRRect) || !SkRRectPriv::AllCornersCircular(devRRect)) {
|
||||
if (!devRRectIsValid || !SkRRectPriv::AllCornersCircular(devRRect)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user