Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: experimental/fiddle/fiddle_main.cpp

Issue 1895103002: experimental/fiddle: update to new SkImage API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/fiddle/fiddle_main.h ('k') | experimental/fiddle/fiddle_test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/fiddle/fiddle_main.cpp
diff --git a/experimental/fiddle/fiddle_main.cpp b/experimental/fiddle/fiddle_main.cpp
index 51c956842b34ab953ded8e0b8cb4ef4476157c0f..3e1570813d0d5d4954bb0aadfa5b44d60fc8cfb3 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<SkImage> image;
static void encode_to_base64(const void* data, size_t size, FILE* out) {
const uint8_t* input = reinterpret_cast<const uint8_t*>(data);
@@ -58,7 +58,7 @@ static void dump_output(const sk_sp<SkData>& data,
}
static SkData* encode_snapshot(const sk_sp<SkSurface>& surface) {
- sk_sp<SkImage> img(surface->newImageSnapshot());
+ sk_sp<SkImage> 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;
}
« no previous file with comments | « experimental/fiddle/fiddle_main.h ('k') | experimental/fiddle/fiddle_test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698