diff options
author | msarett <msarett@google.com> | 2016-03-18 15:41:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 15:41:00 -0700 |
commit | 07ec54d8e6c0e7e6ea11cde867c00bd29da79063 (patch) | |
tree | ce4e4bfebc2f071b3531fee5375273779a020876 | |
parent | c2dc1b29ba82e352f174a7b84519e9a5af55347b (diff) |
Replace uses of SkImageDecoder in src/animator
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1818563002
Review URL: https://codereview.chromium.org/1818563002
-rw-r--r-- | src/animator/SkDrawBitmap.cpp | 14 | ||||
-rw-r--r-- | src/animator/SkDrawBitmap.h | 1 | ||||
-rw-r--r-- | src/animator/SkSnapshot.h | 1 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp index ce7464d702..64c2850a3e 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); } } } diff --git a/src/animator/SkDrawBitmap.h b/src/animator/SkDrawBitmap.h index 270545d0ee..9fd25d604a 100644 --- a/src/animator/SkDrawBitmap.h +++ b/src/animator/SkDrawBitmap.h @@ -13,7 +13,6 @@ #include "SkBoundable.h" #include "SkBase64.h" #include "SkBitmap.h" -// #include "SkImageDecoder.h" #include "SkMemberInfo.h" class SkBaseBitmap : public SkBoundable { diff --git a/src/animator/SkSnapshot.h b/src/animator/SkSnapshot.h index a4eb175777..003a9dc796 100644 --- a/src/animator/SkSnapshot.h +++ b/src/animator/SkSnapshot.h @@ -11,7 +11,6 @@ #define SkSnapShot_DEFINED #include "SkADrawable.h" -#include "SkImageDecoder.h" #include "SkMemberInfo.h" #include "SkString.h" |