diff options
author | Joe Gregorio <jcgregorio@google.com> | 2017-06-14 15:54:32 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-15 13:20:29 +0000 |
commit | 4f12f1e2093c7c23065b09943a373b8308e95a82 (patch) | |
tree | d61c8d05fa232d306d6e171d2ace08c97fe9109f /tools | |
parent | 7e3a36433786a3041c0284d62128f086f06151f3 (diff) |
[fiddle] Clear the canvas to white before calling draw().
Bug: skia:
Change-Id: I17f1d47c3d04f09ca613e2d3f98d4c73e4bad02c
Reviewed-on: https://skia-review.googlesource.com/19847
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Diffstat (limited to 'tools')
-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); |