aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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].