diff options
author | 2016-08-22 06:28:57 -0700 | |
---|---|---|
committer | 2016-08-22 06:28:57 -0700 | |
commit | 582a6564f36c90cc8e3e8c7338578023449b096c (patch) | |
tree | 3e3acdf355c342c22267b11aab10333137f84198 /src/effects | |
parent | 5122967e60915d2b4322bbd059f6f641c11f5216 (diff) |
Simplify the gradient color stop optimizer
We're just discarding the leftmost/rightmost stops -- this can be
achieved by simply adjusting the start offset and count.
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2265803002
Review-Url: https://codereview.chromium.org/2265803002
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/gradients/SkGradientShader.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 58c0d3bd5d..a0cbe974f2 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -786,14 +786,10 @@ struct ColorStopOptimizer { SkShader::kMirror_TileMode == mode || colors[0] == colors[1]) { - fColorStorage[0] = colors[1]; - fColorStorage[1] = colors[2]; - fPosStorage[0] = 0.0f; - fPosStorage[1] = 1.0f; - - fColors = fColorStorage; - fPos = fPosStorage; - fCount = 2; + // Ignore the leftmost color/pos. + fColors += 1; + fPos += 1; + fCount = 2; } } else if (SkScalarNearlyEqual(pos[0], 0.0f) && SkScalarNearlyEqual(pos[1], 1.0f) && @@ -803,6 +799,7 @@ struct ColorStopOptimizer { SkShader::kMirror_TileMode == mode || colors[1] == colors[2]) { + // Ignore the rightmost color/pos. fCount = 2; } } @@ -811,9 +808,6 @@ struct ColorStopOptimizer { const SkColor* fColors; const SkScalar* fPos; int fCount; - - SkColor fColorStorage[2]; - SkScalar fPosStorage[2]; }; sk_sp<SkShader> SkGradientShader::MakeLinear(const SkPoint pts[2], |