diff options
author | 2015-10-21 11:39:06 -0700 | |
---|---|---|
committer | 2015-10-21 11:39:06 -0700 | |
commit | b4a20767ee129ba47cee42e61252a9faec09c3a6 (patch) | |
tree | 9067c1a7feb44065e903329ae1605293476c6453 /src/core | |
parent | b6b8f2727f6b08bbc307aeebac23beeba1e4984f (diff) |
Revert of Remove SkDEPRECATED_InstallDiscardablePixelRef from SkPictureShader (patchset #3 id:40001 of https://codereview.chromium.org/1405103003/ )
Reason for revert:
Test to see if patch fixes Nexus 6.
Original issue's description:
> Remove SkDEPRECATED_InstallDiscardablePixelRef from SkPictureShader
>
> Use an SkImage generator/shader instead.
>
> R=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/fa694ad067976a5b713eec0b6f92ba5efeb0aa9d
TBR=reed@google.com,fmalita@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1407043008
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPictureShader.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index ab599322a5..92e6157343 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -10,7 +10,6 @@ #include "SkBitmap.h" #include "SkBitmapProcShader.h" #include "SkCanvas.h" -#include "SkImage.h" #include "SkImageGenerator.h" #include "SkMatrixUtils.h" #include "SkPicture.h" @@ -218,28 +217,18 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, const SkM if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) { SkMatrix tileMatrix; tileMatrix.setRectToRect(fTile, SkRect::MakeIWH(tileSize.width(), tileSize.height()), - SkMatrix::kFill_ScaleToFit); - - SkAutoTDelete<SkImageGenerator> tileGenerator( - SkImageGenerator::NewFromPicture(tileSize, fPicture, &tileMatrix, nullptr)); - if (!tileGenerator) { - return nullptr; - } - - // Grab this before the generator goes poof! - const SkImageInfo tileInfo = tileGenerator->getInfo(); - - SkAutoTUnref<SkImage> tileImage(SkImage::NewFromGenerator(tileGenerator.detach())); - if (!tileImage) { + SkMatrix::kFill_ScaleToFit); + SkBitmap bm; + if (!SkDEPRECATED_InstallDiscardablePixelRef( + SkImageGenerator::NewFromPicture(tileSize, fPicture, &tileMatrix, nullptr), &bm)) { return nullptr; } SkMatrix shaderMatrix = this->getLocalMatrix(); shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height()); - tileShader.reset(tileImage->newShader(fTmx, fTmy, &shaderMatrix)); + tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix)); - SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(), - tileInfo.getSafeSize(tileInfo.minRowBytes()))); + SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(), bm.getSize())); } return tileShader.detach(); |