diff options
author | Brian Osman <brianosman@google.com> | 2017-09-11 17:21:35 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-11 23:48:49 +0000 |
commit | a8e5744afadd20e217a7c70099a79a222d2e7e4f (patch) | |
tree | 505e42aaa9536bf6ceec0a844c2c88a955928e84 /gm | |
parent | 3261eb219f2cbb027d6876bc99b243fe0b3c7ee3 (diff) |
Add general three-stop analytic gradient shader
This fixes an Android rendering bug where radial gradients were being used
for "clipping" (via DstIn blend mode). The gradient stops were placed at
(0, 0.999, 1), which caused our table quantization to drop the last stop.
kThree_ColorType now means "0, any t, 1". The old (special-case)
kThree_ColorType is now called kSymmetricThree_ColorType.
Bug: skia:
Change-Id: I96a0b9e679f2d537862a3e097f7e3446474914ea
Reviewed-on: https://skia-review.googlesource.com/45260
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/gradients.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gm/gradients.cpp b/gm/gradients.cpp index 2a1f9031bb..08d65f7d12 100644 --- a/gm/gradients.cpp +++ b/gm/gradients.cpp @@ -1074,14 +1074,15 @@ DEF_SIMPLE_GM(sweep_tiling, canvas, 690, 512) { } // Exercises the special-case Ganesh gradient effects. -DEF_SIMPLE_GM(gradients_interesting, canvas, 640, 1080) { +DEF_SIMPLE_GM(gradients_interesting, canvas, 640, 1300) { static const SkColor colors2[] = { SK_ColorRED, SK_ColorBLUE }; static const SkColor colors3[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorBLUE }; static const SkColor colors4[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorYELLOW, SK_ColorBLUE }; - static const SkScalar hardLeft[] = { 0, 0, 1 }; - static const SkScalar hardRight[] = { 0, 1, 1 }; - static const SkScalar hardCenter[] = { 0, .5f, .5f, 1 }; + static const SkScalar softRight[] = { 0, .999f, 1 }; // Based on Android launcher "clipping" + static const SkScalar hardLeft[] = { 0, 0, 1 }; + static const SkScalar hardRight[] = { 0, 1, 1 }; + static const SkScalar hardCenter[] = { 0, .5f, .5f, 1 }; static const struct { const SkColor* colors; @@ -1089,7 +1090,8 @@ DEF_SIMPLE_GM(gradients_interesting, canvas, 640, 1080) { int count; } configs[] = { { colors2, nullptr, 2 }, // kTwo_ColorType - { colors3, nullptr, 3 }, // kThree_ColorType + { colors3, nullptr, 3 }, // kSymmetricThree_ColorType + { colors3, softRight, 3 }, // kThree_ColorType { colors3, hardLeft, 3 }, // kHardStopLeftEdged_ColorType { colors3, hardRight, 3 }, // kHardStopRightEdged_ColorType { colors4, hardCenter, 4 }, // kSingleHardStop_ColorType |