Define sample(null) as returning the inputColor unchanged.
This is more useful than returning half4(1), and there was no existing
code that passed null to sample(), so this will not be a breaking
change.
This change will allow us to replace this boilerplate:
half4 color = (inputFP != null) ? sample(inputFP, sk_InColor)
: sk_InColor;
With:
half4 color = sample(inputFP, sk_InColor);
Change-Id: I7bb1580299af99afccbd3a5fdf4cb1d5c4c96da9
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295002
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/effects/generated/GrAARectEffect.cpp b/src/gpu/effects/generated/GrAARectEffect.cpp
index 423bf02..580bc61 100644
--- a/src/gpu/effects/generated/GrAARectEffect.cpp
+++ b/src/gpu/effects/generated/GrAARectEffect.cpp
@@ -54,17 +54,15 @@
"alpha = 1.0 - alpha;\n}",
(int)_outer.edgeType,
(int)_outer.edgeType);
- SkString _input1697 = SkStringPrintf("%s", args.fInputColor);
- SkString _sample1697;
+ SkString _input1677 = SkStringPrintf("%s", args.fInputColor);
+ SkString _sample1677;
if (_outer.inputFP_index >= 0) {
- _sample1697 = this->invokeChild(_outer.inputFP_index, _input1697.c_str(), args);
+ _sample1677 = this->invokeChild(_outer.inputFP_index, _input1677.c_str(), args);
} else {
- _sample1697 = "half4(1)";
+ _sample1677 = _input1677;
}
- fragBuilder->codeAppendf("\nhalf4 inputColor = %s ? %s : %s;\n%s = inputColor * alpha;\n",
- _outer.inputFP_index >= 0 ? "true" : "false",
- _sample1697.c_str(),
- args.fInputColor,
+ fragBuilder->codeAppendf("\nhalf4 inputColor = %s;\n%s = inputColor * alpha;\n",
+ _sample1677.c_str(),
args.fOutputColor);
}