aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/gradients
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-07-25 13:53:04 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-25 18:36:39 +0000
commit5127fcba572bb93684b394a129e23d06bed281a1 (patch)
treede97ee7d2e04d71d551fa804d8660f438a096730 /src/shaders/gradients
parent4ed9ae4b230425df7735bc4a3778da00f63178de (diff)
Always postConcat() pipeline gradient matrices
In order to unblock https://skia-review.googlesource.com/c/26564 & https://skia-review.googlesource.com/c/26427, switch all impls to use a single/atomic postConcat for the gradient matrix. This is much easier to guard than the changes above. Change-Id: Ib72dbc7b5a56a96390f4468fd12caf8b6a0e46ef Reviewed-on: https://skia-review.googlesource.com/26620 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/shaders/gradients')
-rw-r--r--src/shaders/gradients/SkLinearGradient.cpp4
-rw-r--r--src/shaders/gradients/SkRadialGradient.cpp4
-rw-r--r--src/shaders/gradients/SkSweepGradient.cpp4
-rw-r--r--src/shaders/gradients/SkTwoPointConicalGradient.cpp6
4 files changed, 18 insertions, 0 deletions
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index fc49d3430d..d127f8d06b 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -83,7 +83,11 @@ bool SkLinearGradient::adjustMatrixAndAppendStages(SkArenaAlloc*,
SkMatrix* matrix,
SkRasterPipeline*,
SkRasterPipeline*) const {
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_MATRIX_MATH
*matrix = SkMatrix::Concat(fPtsToUnit, *matrix);
+#else
+ matrix->postConcat(fPtsToUnit);
+#endif
return true;
}
diff --git a/src/shaders/gradients/SkRadialGradient.cpp b/src/shaders/gradients/SkRadialGradient.cpp
index faf0f69d0d..c2ca2fa64f 100644
--- a/src/shaders/gradients/SkRadialGradient.cpp
+++ b/src/shaders/gradients/SkRadialGradient.cpp
@@ -375,8 +375,12 @@ bool SkRadialGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
SkMatrix* matrix,
SkRasterPipeline* p,
SkRasterPipeline*) const {
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_MATRIX_MATH
matrix->postTranslate(-fCenter.fX, -fCenter.fY);
matrix->postScale(1/fRadius, 1/fRadius);
+#else
+ matrix->postConcat(fPtsToUnit);
+#endif
p->append(SkRasterPipeline::xy_to_radius);
return true;
diff --git a/src/shaders/gradients/SkSweepGradient.cpp b/src/shaders/gradients/SkSweepGradient.cpp
index f984542010..0a1d83ec70 100644
--- a/src/shaders/gradients/SkSweepGradient.cpp
+++ b/src/shaders/gradients/SkSweepGradient.cpp
@@ -222,7 +222,11 @@ bool SkSweepGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
SkMatrix* matrix,
SkRasterPipeline* p,
SkRasterPipeline*) const {
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_MATRIX_MATH
matrix->postTranslate(-fCenter.fX, -fCenter.fY);
+#else
+ matrix->postConcat(fPtsToUnit);
+#endif
p->append(SkRasterPipeline::xy_to_unit_angle);
return true;
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
index f355971e43..65842f2b5f 100644
--- a/src/shaders/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
@@ -182,8 +182,14 @@ bool SkTwoPointConicalGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
// When the two circles are concentric, we can pretend we're radial (with a tiny *twist).
if (SkScalarNearlyZero(dCenter)) {
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_MATRIX_MATH
matrix->postTranslate(-fCenter1.fX, -fCenter1.fY);
matrix->postScale(1 / fRadius2, 1 / fRadius2);
+#else
+ const SkMatrix tmp = SkMatrix::Concat(SkMatrix::MakeScale(1 / fRadius2, 1 / fRadius2),
+ SkMatrix::MakeTrans(-fCenter1.fX, -fCenter1.fY));
+ matrix->postConcat(tmp);
+#endif
p->append(SkRasterPipeline::xy_to_radius);
// Tiny twist: radial computes a t for [0, r2], but we want a t for [r1, r2].