add local-matrix to shader::context
BUG=skia:
R=scroggo@google.com, dominikg@chromium.org
Author: reed@google.com
Review URL: https://codereview.chromium.org/263293005
git-svn-id: http://skia.googlecode.com/svn/trunk@14592 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 290baa8..9655e85 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -52,7 +52,7 @@
fPicture->flatten(buffer);
}
-SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix) const {
+SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatrix* localM) const {
SkASSERT(fPicture && fPicture->width() > 0 && fPicture->height() > 0);
SkMatrix m;
@@ -61,6 +61,9 @@
} else {
m = matrix;
}
+ if (localM) {
+ m.preConcat(*localM);
+ }
// Use a rotation-invariant scale
SkPoint scale;
@@ -115,7 +118,7 @@
}
SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const {
- SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix));
+ SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec.fLocalMatrix));
if (NULL == bitmapShader.get()) {
return NULL;
}
@@ -190,7 +193,7 @@
#if SK_SUPPORT_GPU
GrEffectRef* SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint) const {
- SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(context->getMatrix()));
+ SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(context->getMatrix(), NULL));
if (!bitmapShader) {
return NULL;
}