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;
|
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 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 || canBeCircle) {
|
||||||
if (canBeRect) {
|
if (canBeRect) {
|
||||||
fp = GrRectBlurEffect::Make(
|
fp = GrRectBlurEffect::Make(
|
||||||
/*inputFP=*/nullptr, context, *context->priv().caps()->shaderCaps(),
|
/*inputFP=*/nullptr, context, *context->priv().caps()->shaderCaps(),
|
||||||
srcRRect.rect(), viewMatrix, xformedSigma);
|
srcRRect.rect(), viewMatrix, xformedSigma);
|
||||||
} else {
|
} else {
|
||||||
SkPoint center = {srcRRect.getBounds().centerX(), srcRRect.getBounds().centerY()};
|
SkRect devBounds;
|
||||||
viewMatrix.mapPoints(¢er, 1);
|
if (devRRectIsCircle) {
|
||||||
SkScalar radius = viewMatrix.mapVector(0, srcRRect.width()/2.f).length();
|
devBounds = devRRect.getBounds();
|
||||||
SkRect devBounds = {center.x() - radius,
|
} else {
|
||||||
center.y() - radius,
|
SkPoint center = {srcRRect.getBounds().centerX(), srcRRect.getBounds().centerY()};
|
||||||
center.x() + radius,
|
viewMatrix.mapPoints(¢er, 1);
|
||||||
center.y() + radius};
|
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,
|
fp = GrCircleBlurFragmentProcessor::Make(/*inputFP=*/nullptr, context, devBounds,
|
||||||
xformedSigma);
|
xformedSigma);
|
||||||
}
|
}
|
||||||
@ -760,8 +772,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
|
|||||||
if (!viewMatrix.isScaleTranslate()) {
|
if (!viewMatrix.isScaleTranslate()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SkRRect devRRect;
|
if (!devRRectIsValid || !SkRRectPriv::AllCornersCircular(devRRect)) {
|
||||||
if (!srcRRect.transform(viewMatrix, &devRRect) || !SkRRectPriv::AllCornersCircular(devRRect)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user