Tiling support for SkSweepGradient
Expand the sweep gradient definition to include a color stop angular range ([0, 360] by default).
Color stop positions in [0,1] are mapped to this range, and drawing outside is controlled by a
tile mode param.
This is closer to the CSS gradients spec and allows us to use fewer color stops in Blink conic
gradients.
Impl-wise, the remapping is effected after t calculation, and before tiling.
Change-Id: I5d71be01d134404d6eb9d7e2a904ec636b39f855
Reviewed-on: https://skia-review.googlesource.com/27704
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp
index 390ce4a..f6bd362 100644
--- a/gm/tilemodes.cpp
+++ b/gm/tilemodes.cpp
@@ -177,7 +177,8 @@
case 1:
return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 2:
- return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
+ return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr,
+ SK_ARRAY_COUNT(colors), tx, 135, 225, 0, nullptr);
}
return nullptr;
}