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

Unified Diff: src/image/SkImageShader.cpp

Issue 2187613002: Deserialize pictures with custom image-deserializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix legacy case, remove null-check Created 4 years, 4 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 | « src/image/SkImage.cpp ('k') | src/utils/SkBitmapSourceDeserializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImageShader.cpp
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index d9af95d913326a1abd7f7ca1245e39a7aa5bd82e..eb577e175894ea6ab52efc7b8662f5d3013b80c9 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -27,11 +27,11 @@ sk_sp<SkFlattenable> SkImageShader::CreateProc(SkReadBuffer& buffer) {
const TileMode ty = (TileMode)buffer.readUInt();
SkMatrix matrix;
buffer.readMatrix(&matrix);
- SkAutoTUnref<SkImage> img(buffer.readImage());
+ sk_sp<SkImage> img = buffer.readImage();
if (!img) {
return nullptr;
}
- return SkImageShader::Make(img, tx, ty, &matrix);
+ return SkImageShader::Make(img.release(), tx, ty, &matrix);
}
void SkImageShader::flatten(SkWriteBuffer& buffer) const {
@@ -248,14 +248,10 @@ sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
static sk_sp<SkFlattenable> SkBitmapProcShader_CreateProc(SkReadBuffer& buffer) {
SkMatrix lm;
buffer.readMatrix(&lm);
- SkBitmap bm;
- if (!buffer.readBitmap(&bm)) {
- return nullptr;
- }
- bm.setImmutable();
+ sk_sp<SkImage> image = buffer.readBitmapAsImage();
SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt();
SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt();
- return SkShader::MakeBitmapShader(bm, mx, my, &lm);
+ return image ? image->makeShader(mx, my, &lm) : nullptr;
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader)
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/utils/SkBitmapSourceDeserializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698