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
This commit is contained in:
halcanary 2016-04-18 08:17:56 -07:00 committed by Commit bot
parent d9dd428211
commit 7b8b237ef7
3 changed files with 6 additions and 7 deletions

View File

@ -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;
}

View File

@ -10,7 +10,7 @@
#include "skia.h"
extern SkBitmap source;
extern SkImage* image;
extern sk_sp<SkImage> image;
struct DrawOptions {
DrawOptions(int w, int h, bool r, bool g, bool p, bool k, const char* s)

View File

@ -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 .