diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-09 15:42:07 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-09 15:42:07 +0000 |
commit | d12de02542867c7c1be32b6e02e2f5dca9fb9452 (patch) | |
tree | 02a7ac7ad038886b0cded813f5ec3805f22cd527 /src | |
parent | 5d20caea15b574c9027ea4e695a03c4402e1d832 (diff) |
Revert of hide get/setLocalMatrix (https://codereview.chromium.org/279563002/)
Reason for revert:
broke gms
Original issue's description:
> hide get/setLocalMatrix
>
> BUG=skia:
>
> Committed: http://code.google.com/p/skia/source/detail?r=14675
R=fmalita@google.com, dominikg@chromium.org, fmalita@chromium.org
TBR=dominikg@chromium.org, fmalita@chromium.org, fmalita@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: reed@google.com
Review URL: https://codereview.chromium.org/278903002
git-svn-id: http://skia.googlecode.com/svn/trunk@14677 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPictureShader.cpp | 6 | ||||
-rw-r--r-- | src/core/SkShader.cpp | 15 | ||||
-rw-r--r-- | src/effects/SkRectShaderImageFilter.cpp | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFDeviceFlattener.cpp | 7 |
4 files changed, 20 insertions, 14 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 21eba80230..9655e85bd1 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -56,7 +56,11 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri SkASSERT(fPicture && fPicture->width() > 0 && fPicture->height() > 0); SkMatrix m; - m.setConcat(matrix, this->getLocalMatrix()); + if (this->hasLocalMatrix()) { + m.setConcat(matrix, this->getLocalMatrix()); + } else { + m = matrix; + } if (localM) { m.preConcat(*localM); } diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 8dbe6d7029..ebe1a74cc2 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -60,7 +60,7 @@ SkShader::~SkShader() { void SkShader::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); - bool hasLocalM = !fLocalMatrix.isIdentity(); + bool hasLocalM = this->hasLocalMatrix(); buffer.writeBool(hasLocalM); if (hasLocalM) { buffer.writeMatrix(fLocalMatrix); @@ -68,10 +68,13 @@ void SkShader::flatten(SkWriteBuffer& buffer) const { } bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse) const { - SkMatrix total; - total.setConcat(*rec.fMatrix, fLocalMatrix); + const SkMatrix* m = rec.fMatrix; + SkMatrix total; - const SkMatrix* m = &total; + if (this->hasLocalMatrix()) { + total.setConcat(*m, this->getLocalMatrix()); + m = &total; + } if (rec.fLocalMatrix) { total.setConcat(*m, *rec.fLocalMatrix); m = &total; @@ -232,9 +235,9 @@ SkShader* SkShader::CreatePictureShader(SkPicture* src, TileMode tmx, TileMode t #ifndef SK_IGNORE_TO_STRING void SkShader::toString(SkString* str) const { - if (!fLocalMatrix.isIdentity()) { + if (this->hasLocalMatrix()) { str->append(" "); - fLocalMatrix.toString(str); + this->getLocalMatrix().toString(str); } } #endif diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp index bed017c326..13e59c2c27 100644 --- a/src/effects/SkRectShaderImageFilter.cpp +++ b/src/effects/SkRectShaderImageFilter.cpp @@ -66,15 +66,13 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy, return false; } SkCanvas canvas(device.get()); - SkPaint paint; + paint.setShader(fShader); SkMatrix matrix(ctx.ctm()); matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top())); - paint.setShader(SkShader::CreateLocalMatrixShader(fShader, matrix))->unref(); - + fShader->setLocalMatrix(matrix); SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bounds.height())); canvas.drawRect(rect, paint); - *result = device.get()->accessBitmap(false); offset->fX = bounds.fLeft; offset->fY = bounds.fTop; diff --git a/src/pdf/SkPDFDeviceFlattener.cpp b/src/pdf/SkPDFDeviceFlattener.cpp index aea87f6546..91c9803c32 100644 --- a/src/pdf/SkPDFDeviceFlattener.cpp +++ b/src/pdf/SkPDFDeviceFlattener.cpp @@ -6,6 +6,7 @@ */ #include "SkPDFDeviceFlattener.h" + #include "SkDraw.h" static SkISize SkSizeToISize(const SkSize& size) { @@ -24,9 +25,9 @@ SkPDFDeviceFlattener::~SkPDFDeviceFlattener() { static void flattenPaint(const SkDraw& d, SkPaint* paint) { if (paint->getShader()) { - SkAutoTUnref<SkShader> lms(SkShader::CreateLocalMatrixShader(paint->getShader(), - *d.fMatrix)); - paint->setShader(lms); + SkMatrix local = paint->getShader()->getLocalMatrix(); + local.preConcat(*d.fMatrix); + paint->getShader()->setLocalMatrix(local); } } |