Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/core/SkPictureShader.cpp

Issue 1407043008: Revert of Remove SkDEPRECATED_InstallDiscardablePixelRef from SkPictureShader (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureShader.cpp
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index ab599322a57eff618650233aa34da8c8f863760b..92e615734380dd02cc1367bfcc3108e54cef1022 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 @@
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));
-
- SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(),
- tileInfo.getSafeSize(tileInfo.minRowBytes())));
+ tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix));
+
+ SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(), bm.getSize()));
}
return tileShader.detach();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698