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)
59 void print(
const T& command,
double ns) {
60 this->printNameAndTime(command, ns);
63 void print(
const SkRecords::Restore& command,
double ns) {
65 this->printNameAndTime(command, ns);
68 void print(
const SkRecords::Save& command,
double ns) {
69 this->printNameAndTime(command, ns);
73 void print(
const SkRecords::SaveLayer& command,
double ns) {
74 this->printNameAndTime(command, ns);
78 void print(
const SkRecords::DrawPicture& command,
double ns) {
79 this->printNameAndTime(command, ns);
84 const SkRecord& record = *bp->record();
85 for (
int i = 0; i < record.
count(); i++) {
86 record.
visit(i, *
this);
93 void print(
const SkRecords::DrawAnnotation& command,
double ns) {
94 int us = (
int)(ns * 1e-3);
95 if (!FLAGS_timeWithCommand) {
98 printf(
"%*d ", fDigits, fIndex++);
99 for (
int i = 0; i < fIndent; i++) {
102 if (FLAGS_timeWithCommand) {
103 printf(
"%6dus ", us);
105 printf(
"DrawAnnotation [%g %g %g %g] %s\n",
106 command.rect.left(), command.rect.top(), command.rect.right(), command.rect.bottom(),
107 command.key.c_str());
111 template <
typename T>
112 void printNameAndTime(
const T& command,
double ns) {
113 int us = (
int)(ns * 1e-3);
114 if (!FLAGS_timeWithCommand) {
115 printf(
"%6dus ", us);
117 printf(
"%*d ", fDigits, fIndex++);
118 for (
int i = 0; i < fIndent; i++) {
121 if (FLAGS_timeWithCommand) {
124 puts(NameOf(command));
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";
146int main(
int argc,
char** argv) {
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 DEFINE_bool(name, defaultValue, helpString)
#define DEFINE_int(name, defaultValue, helpString)
#define DEFINE_bool2(name, shortName, defaultValue, helpString)
#define DEFINE_string2(name, shortName, defaultValue, helpString)
#define DEFINE_string(name, defaultValue, helpString)
static bool match(const char *needle, const char *haystack)
#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)
Type::kYUV Type::kRGBA() int(0.7 *637)
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[])
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