diff options
Diffstat (limited to 'tools/fiddle')
-rw-r--r-- | tools/fiddle/fiddle_main.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp index dbc0141ca0..74aefb8bbb 100644 --- a/tools/fiddle/fiddle_main.cpp +++ b/tools/fiddle/fiddle_main.cpp @@ -93,6 +93,11 @@ static SkData* encode_snapshot(const sk_sp<SkSurface>& surface) { return img ? img->encode() : nullptr; } +static SkCanvas* prepare_canvas(SkCanvas * canvas) { + canvas->clear(SK_ColorWHITE); + return canvas; +} + int main(int argc, char** argv) { SkCommandLineFlags::Parse(argc, argv); duration = FLAGS_duration; @@ -136,7 +141,7 @@ int main(int argc, char** argv) { if (options.raster) { auto rasterSurface = SkSurface::MakeRaster(info); srand(0); - draw(rasterSurface->getCanvas()); + draw(prepare_canvas(rasterSurface->getCanvas())); rasterData.reset(encode_snapshot(rasterSurface)); } if (options.gpu) { @@ -150,7 +155,7 @@ int main(int argc, char** argv) { exit(1); } srand(0); - draw(surface->getCanvas()); + draw(prepare_canvas(surface->getCanvas())); gpuData.reset(encode_snapshot(surface)); } } @@ -159,7 +164,7 @@ int main(int argc, char** argv) { sk_sp<SkDocument> document(SkDocument::MakePDF(&pdfStream)); if (document) { srand(0); - draw(document->beginPage(options.size.width(), options.size.height())); + draw(prepare_canvas(document->beginPage(options.size.width(), options.size.height()))); document->close(); pdfData = pdfStream.detachAsData(); } @@ -169,7 +174,7 @@ int main(int argc, char** argv) { size = options.size; SkPictureRecorder recorder; srand(0); - draw(recorder.beginRecording(size.width(), size.height())); + draw(prepare_canvas(recorder.beginRecording(size.width(), size.height()))); auto picture = recorder.finishRecordingAsPicture(); SkDynamicMemoryWStream skpStream; picture->serialize(&skpStream); |