10#include "microhttpd.h"
21 static const char* kBasePath =
"/break";
22 return 0 == strcmp(method, MHD_HTTP_METHOD_GET) &&
23 0 == strncmp(url, kBasePath, strlen(kBasePath));
27 const char* url,
const char* method,
28 const char* upload_data,
size_t* upload_data_size) {
32 if (!request->hasPicture() ||
commands.size() != 4) {
38 sscanf(
commands[1].c_str(),
"%d", &n);
44 int count = request->fDebugCanvas->getSize();
47 SkCanvas* canvas = request->getCanvas();
49 int saveCount = canvas->
save();
50 for (
int i = 0;
i <= n; ++
i) {
51 request->fDebugCanvas->getDrawCommandAt(
i)->execute(canvas);
63 for (
int i = n + 1;
i < n +
count; ++
i) {
69 saveCount = canvas->
save();
71 request->fDebugCanvas->getDrawCommandAt(index)->execute(canvas);
72 SkColor current = request->getPixel(
x,
y);
90 return SendData(connection,
stream.detachAsData().get(),
"application/json");
constexpr SkColor SK_ColorWHITE
void SkStrSplit(const char *str, const char *delimiters, SkStrSplitMode splitMode, TArray< SkString > *out)
int handle(Request *request, MHD_Connection *connection, const char *url, const char *method, const char *upload_data, size_t *upload_data_size) override
bool canHandle(const char *method, const char *url) override
static void MakeJsonColor(SkJSONWriter &, const SkColor color)
void clear(SkColor color)
void restoreToCount(int saveCount)
void appendS32(int32_t value)
void beginObject(const char *name=nullptr, bool multiline=true)
void appendName(const char *name)
int SendData(MHD_Connection *connection, const SkData *data, const char *type, bool setContentDisposition, const char *dispositionString)