diff options
author | 2016-03-18 07:25:55 -0700 | |
---|---|---|
committer | 2016-03-18 07:25:55 -0700 | |
commit | ca2622ba051829fed5f30facd74c5b41cd4b931c (patch) | |
tree | 3d8248b7764e500f857b3d6cfb6866e72b632199 /tools/kilobench | |
parent | eb75c7db3a7372de68347d0df8d58acebc33a9ad (diff) |
return pictures as sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811703002
Review URL: https://codereview.chromium.org/1811703002
Diffstat (limited to 'tools/kilobench')
-rw-r--r-- | tools/kilobench/kilobench.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tools/kilobench/kilobench.cpp b/tools/kilobench/kilobench.cpp index 1f92d5341a..06cb33fb49 100644 --- a/tools/kilobench/kilobench.cpp +++ b/tools/kilobench/kilobench.cpp @@ -104,33 +104,28 @@ public: } private: - static bool ReadPicture(const char* path, SkAutoTUnref<SkPicture>* pic) { + static sk_sp<SkPicture> ReadPicture(const char path[]) { // Not strictly necessary, as it will be checked again later, // but helps to avoid a lot of pointless work if we're going to skip it. if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path)) { - return false; + return nullptr; } SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); if (stream.get() == nullptr) { SkDebugf("Could not read %s.\n", path); - return false; + return nullptr; } - pic->reset(SkPicture::CreateFromStream(stream.get())); - if (pic->get() == nullptr) { - SkDebugf("Could not read %s as an SkPicture.\n", path); - return false; - } - return true; + return SkPicture::MakeFromStream(stream.get()); } Benchmark* innerNext() { // Render skps while (fCurrentSKP < fSKPs.count()) { const SkString& path = fSKPs[fCurrentSKP++]; - SkAutoTUnref<SkPicture> pic; - if (!ReadPicture(path.c_str(), &pic)) { + auto pic = ReadPicture(path.c_str()); + if (!pic) { continue; } |