diff options
author | Yuqian Li <liyuqian@google.com> | 2017-12-13 15:47:26 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-13 21:11:10 +0000 |
commit | 81d9f0d42eea5bb428808e0a48e4ef85aec45e10 (patch) | |
tree | f27cba8dd547fb05cc067b5c1cc07c7680ecf52f | |
parent | 9daae51c4ad84b1d6364a7f6415621f12b232a41 (diff) |
Add strip 2pt conical GM
This is distilled from 82161 so we can first change the GMs of our
previous bots and then compare the same GM between the old algorithm
and the new one.
Bug: skia:
Change-Id: I4b13bb1a06d109b60c8e29f5f87adad47d0a811b
Reviewed-on: https://skia-review.googlesource.com/84523
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
-rw-r--r-- | gm/gradients_2pt_conical.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gm/gradients_2pt_conical.cpp b/gm/gradients_2pt_conical.cpp index 3cda2c656d..8a6b19a8f2 100644 --- a/gm/gradients_2pt_conical.cpp +++ b/gm/gradients_2pt_conical.cpp @@ -49,6 +49,16 @@ static sk_sp<SkShader> Make2ConicalOutside(const SkPoint pts[2], const GradData& data.fPos, data.fCount, tm, 0, &localMatrix); } +static sk_sp<SkShader> Make2ConicalOutsideStrip(const SkPoint pts[2], const GradData& data, + SkShader::TileMode tm, const SkMatrix& localMatrix) { + SkPoint center0, center1; + SkScalar radius = (pts[1].fX - pts[0].fX) / 3; + center0.set(pts[0].fX, pts[0].fY); + center1.set(pts[1].fX, pts[1].fY); + return SkGradientShader::MakeTwoPointConical(center0, radius, center1, radius, data.fColors, + data.fPos, data.fCount, tm, 0, &localMatrix); +} + static sk_sp<SkShader> Make2ConicalOutsideFlip(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm, const SkMatrix& localMatrix) { SkPoint center0, center1; @@ -253,7 +263,8 @@ typedef sk_sp<SkShader> (*GradMaker)(const SkPoint pts[2], const GradData& data, constexpr GradMaker gGradMakersOutside[] = { Make2ConicalOutside, Make2ConicalOutsideFlip, - Make2ConicalZeroRadOutside, Make2ConicalZeroRadFlipOutside + Make2ConicalZeroRadOutside, Make2ConicalZeroRadFlipOutside, + Make2ConicalOutsideStrip }; constexpr GradMaker gGradMakersInside[] = { |