From ca2622ba051829fed5f30facd74c5b41cd4b931c Mon Sep 17 00:00:00 2001 From: reed Date: Fri, 18 Mar 2016 07:25:55 -0700 Subject: 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 --- tools/kilobench/kilobench.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tools/kilobench') 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* pic) { + static sk_sp 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 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 pic; - if (!ReadPicture(path.c_str(), &pic)) { + auto pic = ReadPicture(path.c_str()); + if (!pic) { continue; } -- cgit v1.2.3