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

Unified Diff: tools/skiaserve/skiaserve.cpp

Issue 1705093002: Add batch information to json (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix cpu bot 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/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skiaserve/skiaserve.cpp
diff --git a/tools/skiaserve/skiaserve.cpp b/tools/skiaserve/skiaserve.cpp
index 119f065ac071d10632fbaf463b3dea404ba78d57..717e6855c465a1da75d8d8fe2b6128fd74dcc977 100644
--- a/tools/skiaserve/skiaserve.cpp
+++ b/tools/skiaserve/skiaserve.cpp
@@ -136,13 +136,18 @@ SkData* writeCanvasToPng(SkCanvas* canvas) {
return buffer.copyToData();
}
-SkData* setupAndDrawToCanvasReturnPng(Request* request, int n) {
+SkCanvas* getCanvasFromRequest(Request* request) {
GrContextFactory* factory = request->fContextFactory;
SkGLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType,
GrContextFactory::kNone_GLContextOptions).fGLContext;
gl->makeCurrent();
SkASSERT(request->fDebugCanvas);
SkCanvas* target = request->fSurface->getCanvas();
+ return target;
+}
+
+SkData* setupAndDrawToCanvasReturnPng(Request* request, int n) {
+ SkCanvas* target = getCanvasFromRequest(request);
request->fDebugCanvas->drawTo(target, n);
return writeCanvasToPng(target);
}
@@ -195,9 +200,9 @@ static int SendData(MHD_Connection* connection, const SkData* data, const char*
return ret;
}
-static int SendJSON(MHD_Connection* connection, SkDebugCanvas* debugCanvas,
+static int SendJSON(MHD_Connection* connection, SkCanvas* canvas, SkDebugCanvas* debugCanvas,
UrlDataManager* urlDataManager, int n) {
- Json::Value root = debugCanvas->toJSON(*urlDataManager, n);
+ Json::Value root = debugCanvas->toJSON(*urlDataManager, n, canvas);
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(root).c_str());
@@ -261,7 +266,8 @@ public:
} else {
sscanf(commands[1].c_str(), "%d", &n);
}
- return SendJSON(connection, request->fDebugCanvas, &request->fUrlDataManager, n);
+ return SendJSON(connection, getCanvasFromRequest(request), request->fDebugCanvas,
+ &request->fUrlDataManager, n);
}
// /cmd/N, for now only delete supported
« no previous file with comments | « tools/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698