Fix clipping when all analytic FP creations can be skipped
BUG=skia:
Review URL: https://codereview.chromium.org/1400343004
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 882f607..4b464bb 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -108,10 +108,10 @@
return false;
}
-const GrFragmentProcessor* GrClipMaskManager::getAnalyticClipProcessor(
- const GrReducedClip::ElementList& elements,
- const SkVector& clipToRTOffset,
- const SkRect* drawBounds) {
+bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementList& elements,
+ SkVector& clipToRTOffset,
+ const SkRect* drawBounds,
+ const GrFragmentProcessor** resultFP) {
SkRect boundsInClipSpace;
if (drawBounds) {
boundsInClipSpace = *drawBounds;
@@ -190,14 +190,14 @@
iter.next();
}
- const GrFragmentProcessor* resultFP = nullptr;
- if (!failed) {
- resultFP = GrFragmentProcessor::RunInSeries(fps, fpCnt);
+ *resultFP = nullptr;
+ if (!failed && fpCnt) {
+ *resultFP = GrFragmentProcessor::RunInSeries(fps, fpCnt);
}
for (int i = 0; i < fpCnt; ++i) {
fps[i]->unref();
}
- return resultFP;
+ return !failed;
}
////////////////////////////////////////////////////////////////////////////////
@@ -283,7 +283,7 @@
const GrFragmentProcessor* clipFP = nullptr;
if (elements.isEmpty() ||
(requiresAA && !disallowAnalyticAA &&
- SkToBool(clipFP = this->getAnalyticClipProcessor(elements, clipToRTOffset, devBounds)))) {
+ this->getAnalyticClipProcessor(elements, clipToRTOffset, devBounds, &clipFP))) {
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(-clip.origin());
if (nullptr == devBounds ||