Index: tools/skiaserve/urlhandlers/ImgHandler.cpp |
diff --git a/tools/skiaserve/urlhandlers/ImgHandler.cpp b/tools/skiaserve/urlhandlers/ImgHandler.cpp |
index 3e390fe8325ae644426d395b63c643581851d140..a0e58bcc4dfec06037dff9550853a4c89541b8ed 100644 |
--- a/tools/skiaserve/urlhandlers/ImgHandler.cpp |
+++ b/tools/skiaserve/urlhandlers/ImgHandler.cpp |
@@ -25,19 +25,22 @@ int ImgHandler::handle(Request* request, MHD_Connection* connection, |
SkTArray<SkString> commands; |
SkStrSplit(url, "/", &commands); |
- if (!request->hasPicture() || commands.count() > 2) { |
+ if (!request->hasPicture() || commands.count() > 3) { |
return MHD_NO; |
} |
- int n; |
+ int n, m = -1; |
// /img or /img/N |
if (commands.count() == 1) { |
n = request->fDebugCanvas->getSize() - 1; |
+ } else if (commands.count() == 2) { |
+ sscanf(commands[1].c_str(), "%d", &n); |
} else { |
sscanf(commands[1].c_str(), "%d", &n); |
+ sscanf(commands[2].c_str(), "%d", &m); |
} |
- SkAutoTUnref<SkData> data(request->drawToPng(n)); |
+ SkAutoTUnref<SkData> data(request->drawToPng(n, m)); |
return SendData(connection, data, "image/png"); |
} |