aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/kilobench
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-18 07:25:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-18 07:25:55 -0700
commitca2622ba051829fed5f30facd74c5b41cd4b931c (patch)
tree3d8248b7764e500f857b3d6cfb6866e72b632199 /tools/kilobench
parenteb75c7db3a7372de68347d0df8d58acebc33a9ad (diff)
return pictures as sk_sp
Diffstat (limited to 'tools/kilobench')
-rw-r--r--tools/kilobench/kilobench.cpp17
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;
}