diff options
author | Mike Reed <reed@google.com> | 2017-07-23 13:14:10 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2017-07-23 18:24:24 +0000 |
commit | 71f867c2294655ccf8981500ad5a3beefb71295e (patch) | |
tree | 201d6568fa87c239742211f1e9a67d10c5d32f61 /tools | |
parent | 7b215bcad3034aca262ca4eeebe31b5e8868638b (diff) |
have resources return unique_ptr for stream
Bug: skia:
Change-Id: I649f4435d06704a5a581a481fe3c46b6ec677baf
Reviewed-on: https://skia-review.googlesource.com/26041
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Resources.cpp | 4 | ||||
-rw-r--r-- | tools/Resources.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/Resources.cpp b/tools/Resources.cpp index f93cf24381..27ccef44f6 100644 --- a/tools/Resources.cpp +++ b/tools/Resources.cpp @@ -44,14 +44,14 @@ sk_sp<SkImage> GetResourceAsImage(const char* resource) { return SkImage::MakeFromEncoded(resourceData); } -SkStreamAsset* GetResourceAsStream(const char* resource) { +std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource) { SkString resourcePath = GetResourcePath(resource); std::unique_ptr<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); if (!stream->isValid()) { SkDebugf("Resource %s not found.\n", resource); return nullptr; } - return stream.release(); + return std::move(stream); } sk_sp<SkData> GetResourceAsData(const char* resource) { diff --git a/tools/Resources.h b/tools/Resources.h index fa1ca451a9..01eaa3f214 100644 --- a/tools/Resources.h +++ b/tools/Resources.h @@ -22,7 +22,7 @@ void SetResourcePath(const char* ); bool GetResourceAsBitmap(const char* resource, SkBitmap* dst); sk_sp<SkImage> GetResourceAsImage(const char* resource); -SkStreamAsset* GetResourceAsStream(const char* resource); +std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource); sk_sp<SkData> GetResourceAsData(const char* resource); sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource); |