28 {
31
33 return MHD_NO;
34 }
35
36
37 int n;
38 sscanf(commands[1].c_str(), "%d", &n);
40 sscanf(commands[2].c_str(),
"%d", &
x);
42 sscanf(commands[3].c_str(),
"%d", &
y);
43
46
49 int saveCount = canvas->
save();
50 for (int i = 0; i <= n; ++i) {
51 request->
fDebugCanvas->getDrawCommandAt(i)->execute(canvas);
52 }
54
57 writer.beginObject();
58
59 writer.appendName("startColor");
61
62 bool changed = false;
63 for (
int i = n + 1; i < n +
count; ++i) {
64 int index = i %
count;
65 if (index == 0) {
66
69 saveCount = canvas->
save();
70 }
71 request->
fDebugCanvas->getDrawCommandAt(index)->execute(canvas);
74 writer.appendName("endColor");
76 writer.appendS32("endOp", index);
77 changed = true;
78 break;
79 }
80 }
81 if (!changed) {
82 writer.appendName("endColor");
84 writer.appendS32("endOp", n);
85 }
87
88 writer.endObject();
89 writer.flush();
90 return SendData(connection,
stream.detachAsData().get(),
"application/json");
91}
constexpr SkColor SK_ColorWHITE
void SkStrSplit(const char *str, const char *delimiters, SkStrSplitMode splitMode, TArray< SkString > *out)
static void MakeJsonColor(SkJSONWriter &, const SkColor color)
void clear(SkColor color)
void restoreToCount(int saveCount)
int SendData(MHD_Connection *connection, const SkData *data, const char *type, bool setContentDisposition, const char *dispositionString)
SkColor getPixel(int x, int y)
std::unique_ptr< DebugCanvas > fDebugCanvas