Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2d01ed9

Browse files
johnstiles-googleSkia Commit-Bot
authored andcommitted
Replace manually-implemented lerp with mix().
Change-Id: I6bf3cac6df654a0b23ced250df90716f6856ed29 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307197 Commit-Queue: John Stiles <[email protected]> Commit-Queue: Brian Osman <[email protected]> Reviewed-by: Brian Osman <[email protected]> Auto-Submit: John Stiles <[email protected]>
1 parent cec3a60 commit 2d01ed9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/gpu/gradients/GrSingleIntervalGradientColorizer.fp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* found in the LICENSE file.
66
*/
77

8-
// This only supports a 2-color single interval so it is a simple linear interpolation between the
8+
// This only supports a 2-color single interval so it is a simple linear interpolation between the
99
// two end points based on t. But it serves as a good test for connecting all of the plumbing into a
1010
// functional gradient shader.
1111

@@ -17,5 +17,5 @@ void main() {
1717

1818
// Clamping and/or wrapping was already handled by the parent shader so the output color is a
1919
// simple lerp.
20-
sk_OutColor = (1 - t) * start + t * end;
20+
sk_OutColor = mix(start, end, t);
2121
}

src/gpu/gradients/generated/GrSingleIntervalGradientColorizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class GrGLSLSingleIntervalGradientColorizer : public GrGLSLFragmentProcessor {
3535
"end");
3636
fragBuilder->codeAppendf(
3737
R"SkSL(half t = %s.x;
38-
%s = (1.0 - t) * %s + t * %s;
38+
%s = mix(%s, %s, t);
3939
)SkSL",
4040
args.fInputColor, args.fOutputColor, args.fUniformHandler->getUniformCStr(startVar),
4141
args.fUniformHandler->getUniformCStr(endVar));

0 commit comments

Comments
 (0)