From 7b8b237ef7d82c9985e4f3cec54562f953ae2ce7 Mon Sep 17 00:00:00 2001 From: halcanary Date: Mon, 18 Apr 2016 08:17:56 -0700 Subject: [PATCH] experimental/fiddle: update to new SkImage API required by https://crrev.com/1897453002 NOTRY=true TBR=jcgregorio@google.com Review URL: https://codereview.chromium.org/1895103002 --- experimental/fiddle/fiddle_main.cpp | 7 +++---- experimental/fiddle/fiddle_main.h | 2 +- experimental/fiddle/fiddle_test | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/experimental/fiddle/fiddle_main.cpp b/experimental/fiddle/fiddle_main.cpp index 51c956842b..3e1570813d 100644 --- a/experimental/fiddle/fiddle_main.cpp +++ b/experimental/fiddle/fiddle_main.cpp @@ -13,7 +13,7 @@ // Globals externed in fiddle_main.h SkBitmap source; -SkImage* image(nullptr); +sk_sp image; static void encode_to_base64(const void* data, size_t size, FILE* out) { const uint8_t* input = reinterpret_cast(data); @@ -58,7 +58,7 @@ static void dump_output(const sk_sp& data, } static SkData* encode_snapshot(const sk_sp& surface) { - sk_sp img(surface->newImageSnapshot()); + sk_sp img(surface->makeImageSnapshot()); return img ? img->encode() : nullptr; } @@ -98,7 +98,7 @@ int main() { perror(options.source); return 1; } else { - image = SkImage::NewFromEncoded(data.get()); + image = SkImage::MakeFromEncoded(std::move(data)); if (!image) { perror("Unable to decode the source image."); return 1; @@ -160,6 +160,5 @@ int main() { dump_output(skpData, "Skp"); printf("}\n"); - SkSafeSetNull(image); return 0; } diff --git a/experimental/fiddle/fiddle_main.h b/experimental/fiddle/fiddle_main.h index ab2aa8b5ab..6330384530 100644 --- a/experimental/fiddle/fiddle_main.h +++ b/experimental/fiddle/fiddle_main.h @@ -10,7 +10,7 @@ #include "skia.h" extern SkBitmap source; -extern SkImage* image; +extern sk_sp image; struct DrawOptions { DrawOptions(int w, int h, bool r, bool g, bool p, bool k, const char* s) diff --git a/experimental/fiddle/fiddle_test b/experimental/fiddle/fiddle_test index c19914248b..c95ac7f234 100755 --- a/experimental/fiddle/fiddle_test +++ b/experimental/fiddle/fiddle_test @@ -24,10 +24,10 @@ fi echo "Building Skia and Fiddle" cd "${skia_dir}/experimental/fiddle" +git clean -fxd . go build fiddler.go ./fiddler "$skia_dir" ./fiddler "$skia_dir" draw.cpp > /dev/null echo "cleaning up" -cd "$skia_dir" -git clean -fxd cmake experimental/fiddle +git clean -fxd .