Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: tools/skiaserve/urlhandlers/ImgHandler.cpp

Issue 1755563003: add /img/n/m endpoint to skiaserve (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: tweak Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/skiaserve/Request.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
}
« no previous file with comments | « tools/skiaserve/Request.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698