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

Unified Diff: src/animator/SkDrawBitmap.cpp

Issue 1818563002: Replace uses of SkImageDecoder in src/animator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/animator/SkDrawBitmap.h ('k') | src/animator/SkSnapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/animator/SkDrawBitmap.cpp
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index ce7464d702bd6e20c4f1f8ce89ddc342480e1b42..64c2850a3e40a86cd521d993792c954f31d129b4 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -10,7 +10,8 @@
#include "SkDrawBitmap.h"
#include "SkAnimateMaker.h"
#include "SkCanvas.h"
-#include "SkImageDecoder.h"
+#include "SkData.h"
+#include "SkImage.h"
#include "SkPaint.h"
#include "SkStream.h"
@@ -181,7 +182,9 @@ void SkImageBaseBitmap::resolve() {
fDirty = false;
if (base64.fData) {
fBitmap.reset();
- SkImageDecoder::DecodeMemory(base64.fData, base64.fLength, &fBitmap);
+ sk_sp<SkData> data = SkData::MakeWithoutCopy(base64.fData, base64.fLength);
+ sk_sp<SkImage> image = SkImage::MakeFromEncoded(data);
+ image->asLegacyBitmap(&fBitmap, SkImage::kRO_LegacyBitmapMode);
} else if (src.size()) {
if (fLast.equals(src))
return;
@@ -189,9 +192,10 @@ void SkImageBaseBitmap::resolve() {
fBitmap.reset();
//SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str());
- SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(src.c_str()));
- if (stream.get()) {
- SkImageDecoder::DecodeStream(stream, &fBitmap);
+ sk_sp<SkData> data = SkData::MakeFromFileName(src.c_str());
+ if (data) {
+ sk_sp<SkImage> image = SkImage::MakeFromEncoded(data);
+ image->asLegacyBitmap(&fBitmap, SkImage::kRO_LegacyBitmapMode);
}
}
}
« no previous file with comments | « src/animator/SkDrawBitmap.h ('k') | src/animator/SkSnapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698