aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/SkShaderBase.h
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-04-10 16:47:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-11 11:25:06 +0000
commit2097fd03ffea48bd904c48c93348b2350600870e (patch)
tree11fac8634429396ed18c59d1e73a8e5dde379de8 /src/shaders/SkShaderBase.h
parenta479f96dafa94549ed3b5b72d1d25bacd9d18b16 (diff)
Fix handling of MaskFilter matrices
1) extend GrFPArgs to track pre/post local matrices, add helpers for creating pre/post wrapper args 2) add a SkShaderBase helper (totalLocalMatrix) to centralize the LM sandwich logic. 3) update call sites to use the above 4) rename SkMatrixFilter::makeWithLocalMatrix -> makeWithMatrix, to disambiguate vs. SkShader::makeWithLocalMatrix. BUG=skia:7744 Change-Id: Ib2b7b007e6924979b00649dde7c94ef4b34771f1 Reviewed-on: https://skia-review.googlesource.com/119330 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/shaders/SkShaderBase.h')
-rw-r--r--src/shaders/SkShaderBase.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/shaders/SkShaderBase.h b/src/shaders/SkShaderBase.h
index 89674a6ebb..cddc5540ee 100644
--- a/src/shaders/SkShaderBase.h
+++ b/src/shaders/SkShaderBase.h
@@ -12,6 +12,7 @@
#include "SkMask.h"
#include "SkMatrix.h"
#include "SkShader.h"
+#include "SkTLazy.h"
#if SK_SUPPORT_GPU
#include "GrFPArgs.h"
@@ -185,9 +186,16 @@ public:
// If this returns false, then we draw nothing (do not fall back to shader context)
bool appendStages(const StageRec&) const;
- bool computeTotalInverse(const SkMatrix& ctm,
- const SkMatrix* outerLocalMatrix,
- SkMatrix* totalInverse) const;
+ bool SK_WARN_UNUSED_RESULT computeTotalInverse(const SkMatrix& ctm,
+ const SkMatrix* outerLocalMatrix,
+ SkMatrix* totalInverse) const;
+
+ // Returns the total local matrix for this shader:
+ //
+ // M = postLocalMatrix x shaderLocalMatrix x preLocalMatrix
+ //
+ SkTCopyOnFirstWrite<SkMatrix> totalLocalMatrix(const SkMatrix* preLocalMatrix,
+ const SkMatrix* postLocalMatrix = nullptr) const;
#ifdef SK_SUPPORT_LEGACY_SHADER_ISABITMAP
virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const {