28static DEFINE_int(tile, 1000000000,
"Simulated tile size.");
30 "If true, print time next to command, else in first column.");
39 , fDraw(canvas, nullptr, nullptr, 0, nullptr)
60 this->printNameAndTime(
command, ns);
65 this->printNameAndTime(
command, ns);
69 this->printNameAndTime(
command, ns);
74 this->printNameAndTime(
command, ns);
79 this->printNameAndTime(
command, ns);
85 for (
int i = 0;
i < record.
count();
i++) {
94 int us = (
int)(ns * 1
e-3);
95 if (!FLAGS_timeWithCommand) {
98 printf(
"%*d ", fDigits, fIndex++);
99 for (
int i = 0;
i < fIndent;
i++) {
102 if (FLAGS_timeWithCommand) {
105 printf(
"DrawAnnotation [%g %g %g %g] %s\n",
111 template <
typename T>
112 void printNameAndTime(
const T&
command,
double ns) {
113 int us = (
int)(ns * 1
e-3);
114 if (!FLAGS_timeWithCommand) {
117 printf(
"%*d ", fDigits, fIndex++);
118 for (
int i = 0;
i < fIndent;
i++) {
121 if (FLAGS_timeWithCommand) {
127 template <
typename T>
128 static const char* NameOf(
const T&) {
129 #define CASE(U) case SkRecords::U##_Type: return #U;
136 static const char* NameOf(
const SkRecords::SaveLayer&) {
137 return "\x1b[31;1mSaveLayer\x1b[0m";
149 for (
int i = 0;
i < FLAGS_skps.size();
i++) {
156 SkDebugf(
"Could not read %s.\n", FLAGS_skps[
i]);
161 SkDebugf(
"Could not read %s as an SkPicture.\n", FLAGS_skps[
i]);
171 if (FLAGS_optimize) {
181 printf(
"%s %s\n", FLAGS_optimize ?
"optimized" :
"not-optimized", FLAGS_skps[
i]);
184 for (
int j = 0; j < record.
count(); j++) {
185 record.
visit(j, dumper);
188 if (FLAGS_write.size() > 0) {
203 dst->serialize(&ostream, &sProcs);
#define SkDEBUGFAIL(message)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkTileMode optimize(SkTileMode tm, int dimension)
void SkRecordDraw(const SkRecord &record, SkCanvas *canvas, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *bbh, SkPicture::AbortCallback *callback)
void SkRecordOptimize(SkRecord *record)
#define SK_RECORD_TYPES(M)
#define SkScalarCeilToInt(x)
static bool ShouldSkip(const SkTDArray< const char * > &strings, const char *name)
static void Parse(int argc, const char *const *argv)
void operator()(const T &command)
void print(const SkRecords::DrawPicture &command, double ns)
void operator()(const SkRecords::NoOp &)
void print(const SkRecords::DrawAnnotation &command, double ns)
void print(const SkRecords::Restore &command, double ns)
void print(const SkRecords::Save &command, double ns)
void print(const T &command, double ns)
Dumper(SkCanvas *canvas, int count)
void print(const SkRecords::SaveLayer &command, double ns)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
static const SkBigPicture * AsSkBigPicture(const sk_sp< const SkPicture > &picture)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
static DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.")
int main(int argc, char **argv)
static DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else in first column.")
static DEFINE_int(tile, 1000000000, "Simulated tile size.")
static DEFINE_string(match, "", "The usual filters on file names to dump.")
static DEFINE_string2(skps, r, "", ".SKPs to dump.")
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
void write(SkWStream *wStream, const T &text)
static SkRect MakeIWH(int w, int h)
static constexpr SkRect MakeWH(float w, float h)
SkSerialImageProc fImageProc