Support MakeResult in GrOvalEffect.
Because GrOvalEffect is used in GrRRectEffect, this will be useful in
followup CLs that port over GrRRectEffect to MakeResult.
Change-Id: Id1d9344af7666d79c62766adfeb920e4ac124a4e
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296596
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/generated/GrCircleEffect.cpp b/src/gpu/effects/generated/GrCircleEffect.cpp
index 7011949..a4846fb 100644
--- a/src/gpu/effects/generated/GrCircleEffect.cpp
+++ b/src/gpu/effects/generated/GrCircleEffect.cpp
@@ -43,17 +43,17 @@
args.fUniformHandler->getUniformCStr(circleVar),
args.fUniformHandler->getUniformCStr(circleVar),
args.fUniformHandler->getUniformCStr(circleVar));
- SkString _input2569 = SkStringPrintf("%s", args.fInputColor);
- SkString _sample2569;
+ SkString _input2566 = SkStringPrintf("%s", args.fInputColor);
+ SkString _sample2566;
if (_outer.inputFP_index >= 0) {
- _sample2569 = this->invokeChild(_outer.inputFP_index, _input2569.c_str(), args);
+ _sample2566 = this->invokeChild(_outer.inputFP_index, _input2566.c_str(), args);
} else {
- _sample2569 = _input2569;
+ _sample2566 = _input2566;
}
fragBuilder->codeAppendf(
"\nhalf4 inputColor = %s;\n@if (%d == 1 || %d == 3) {\n %s = inputColor * "
"clamp(d, 0.0, 1.0);\n} else {\n %s = d > 0.5 ? inputColor : half4(0.0);\n}\n",
- _sample2569.c_str(), (int)_outer.edgeType, (int)_outer.edgeType, args.fOutputColor,
+ _sample2566.c_str(), (int)_outer.edgeType, (int)_outer.edgeType, args.fOutputColor,
args.fOutputColor);
}
@@ -124,7 +124,12 @@
center.fX = testData->fRandom->nextRangeScalar(0.f, 1000.f);
center.fY = testData->fRandom->nextRangeScalar(0.f, 1000.f);
SkScalar radius = testData->fRandom->nextRangeF(1.f, 1000.f);
- GrClipEdgeType et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
- return GrCircleEffect::Make(/*inputFP=*/nullptr, et, center, radius);
+ bool success;
+ std::unique_ptr<GrFragmentProcessor> fp;
+ do {
+ GrClipEdgeType et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
+ std::tie(success, fp) = GrCircleEffect::Make(/*inputFP=*/nullptr, et, center, radius);
+ } while (!success);
+ return fp;
}
#endif