diff options
author | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-19 02:18:33 +0000 |
---|---|---|
committer | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-19 02:18:33 +0000 |
commit | f381162e5616daacdbcc06d693aca5111aeeebe8 (patch) | |
tree | d98e59244b369cb83d3880f961079a4da505c058 /src/animator | |
parent | 54d5f83c33ad123aa398e1c3eaf8394d972d5d3f (diff) |
use SkStream::NewFromFile()
git-svn-id: http://skia.googlecode.com/svn/trunk@8210 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/animator')
-rw-r--r-- | src/animator/SkAnimateMaker.cpp | 16 | ||||
-rw-r--r-- | src/animator/SkAnimator.cpp | 12 | ||||
-rw-r--r-- | src/animator/SkDrawBitmap.cpp | 8 |
3 files changed, 20 insertions, 16 deletions
diff --git a/src/animator/SkAnimateMaker.cpp b/src/animator/SkAnimateMaker.cpp index ddde2eb891..a3ebb642fe 100644 --- a/src/animator/SkAnimateMaker.cpp +++ b/src/animator/SkAnimateMaker.cpp @@ -99,13 +99,15 @@ bool SkAnimateMaker::decodeURI(const char uri[]) { // SkDebugf("animator decode %s\n", uri); // SkStream* stream = SkStream::GetURIStream(fPrefix.c_str(), uri); - SkStream* stream = new SkFILEStream(uri); - - SkAutoTDelete<SkStream> autoDel(stream); - bool success = decodeStream(stream); - if (hasError() && fError.hasNoun() == false) - fError.setNoun(uri); - return success; + SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(uri)); + if (stream.get()) { + bool success = decodeStream(stream); + if (hasError() && fError.hasNoun() == false) + fError.setNoun(uri); + return success; + } else { + return false; + } } #if defined SK_DEBUG && 0 diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp index 6d8fb62db5..1c53e30a95 100644 --- a/src/animator/SkAnimator.cpp +++ b/src/animator/SkAnimator.cpp @@ -84,11 +84,13 @@ bool SkAnimator::decodeURI(const char uri[]) { // SkDebugf("animator decode %s\n", uri); // SkStream* stream = SkStream::GetURIStream(fMaker->fPrefix.c_str(), uri); - SkStream* stream = new SkFILEStream(uri); - - SkAutoTDelete<SkStream> autoDel(stream); - setURIBase(uri); - return decodeStream(stream); + SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(uri)); + if (stream.get()) { + this->setURIBase(uri); + return decodeStream(stream); + } else { + return false; + } } bool SkAnimator::doCharEvent(SkUnichar code) { diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp index 2a482d7584..30af9dbd0e 100644 --- a/src/animator/SkDrawBitmap.cpp +++ b/src/animator/SkDrawBitmap.cpp @@ -190,9 +190,9 @@ void SkImageBaseBitmap::resolve() { fBitmap.reset(); //SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str()); - SkStream* stream = new SkFILEStream(src.c_str()); - - SkAutoTDelete<SkStream> autoDel(stream); - SkImageDecoder::DecodeStream(stream, &fBitmap); + SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(src.c_str())); + if (stream.get()) { + SkImageDecoder::DecodeStream(stream, &fBitmap); + } } } |