| Index: tools/dump_record.cpp
|
| diff --git a/tools/dump_record.cpp b/tools/dump_record.cpp
|
| index 49781bf1bc8c0e349604febfe8cecbc47e2cfa67..1b5f1dc27cc95418d53bc4fc5029993b52132565 100644
|
| --- a/tools/dump_record.cpp
|
| +++ b/tools/dump_record.cpp
|
| @@ -9,6 +9,8 @@
|
| #include "LazyDecodeBitmap.h"
|
| #include "SkCommandLineFlags.h"
|
| #include "SkPicture.h"
|
| +#include "SkPictureRecorder.h"
|
| +#include "SkRecordDraw.h"
|
| #include "SkRecordOpts.h"
|
| #include "SkRecorder.h"
|
| #include "SkStream.h"
|
| @@ -19,6 +21,7 @@ DEFINE_string(match, "", "The usual filters on file names to dump.");
|
| DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
|
| DEFINE_int32(tile, 1000000000, "Simulated tile size.");
|
| DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else in first column.");
|
| +DEFINE_string2(write, w, "", "Write the (optimized) picture to the named file.");
|
|
|
| static void dump(const char* name, int w, int h, const SkRecord& record) {
|
| SkBitmap bitmap;
|
| @@ -32,7 +35,6 @@ static void dump(const char* name, int w, int h, const SkRecord& record) {
|
| DumpRecord(record, &canvas, FLAGS_timeWithCommand);
|
| }
|
|
|
| -
|
| int tool_main(int argc, char** argv);
|
| int tool_main(int argc, char** argv) {
|
| SkCommandLineFlags::Parse(argc, argv);
|
| @@ -65,6 +67,20 @@ int tool_main(int argc, char** argv) {
|
| }
|
|
|
| dump(FLAGS_skps[i], w, h, record);
|
| +
|
| + if (FLAGS_write.count() > 0) {
|
| + SkPictureRecorder r;
|
| + SkRecordDraw(record,
|
| + r.beginRecording(SkRect::MakeIWH(w, h)),
|
| + nullptr,
|
| + nullptr,
|
| + 0,
|
| + nullptr,
|
| + nullptr);
|
| + SkAutoTUnref<SkPicture> dst(r.endRecording());
|
| + SkFILEWStream ostream(FLAGS_write[0]);
|
| + dst->serialize(&ostream);
|
| + }
|
| }
|
|
|
| return 0;
|
|
|