aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2016-03-03 11:39:38 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-03 11:39:39 -0800
commitbd72413059d913ceddbf5cd29327c05b13a62503 (patch)
treec266e9241bcbb330cdacf63a25109614fde65be0
parent862110042d715214b484e643194336c0f0b28659 (diff)
Remove dependency on SkJsonCanvas.h
-rw-r--r--gyp/skiaserve.gyp1
-rw-r--r--tools/debugger/SkDrawCommand.cpp12
-rw-r--r--tools/debugger/SkDrawCommand.h4
-rw-r--r--tools/skiaserve/Request.cpp6
4 files changed, 12 insertions, 11 deletions
diff --git a/gyp/skiaserve.gyp b/gyp/skiaserve.gyp
index 1b46d22528..2cd13b5806 100644
--- a/gyp/skiaserve.gyp
+++ b/gyp/skiaserve.gyp
@@ -34,7 +34,6 @@
'dependencies': [
'flags.gyp:flags',
'gputest.gyp:skgputest',
- 'json.gyp:json',
'jsoncpp.gyp:jsoncpp',
'libpng.gyp:libpng',
'microhttpd.gyp:microhttpd',
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 1af299831f..34cbee7ff5 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -456,7 +456,7 @@ static Json::Value make_json_rect(const SkRect& rect) {
return result;
}
-static Json::Value make_json_irect(const SkIRect& rect) {
+Json::Value SkDrawCommand::MakeJsonIRect(const SkIRect& rect) {
Json::Value result(Json::arrayValue);
result.append(Json::Value(rect.left()));
result.append(Json::Value(rect.top()));
@@ -475,7 +475,7 @@ static Json::Value make_json_rrect(const SkRRect& rrect) {
return result;
}
-static Json::Value make_json_matrix(const SkMatrix& matrix) {
+Json::Value SkDrawCommand::MakeJsonMatrix(const SkMatrix& matrix) {
Json::Value result(Json::arrayValue);
Json::Value row1(Json::arrayValue);
row1.append(Json::Value(matrix[0]));
@@ -1707,7 +1707,7 @@ void SkConcatCommand::execute(SkCanvas* canvas) const {
Json::Value SkConcatCommand::toJSON(UrlDataManager& urlDataManager) const {
Json::Value result = INHERITED::toJSON(urlDataManager);
- result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = make_json_matrix(fMatrix);
+ result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
return result;
}
@@ -1819,7 +1819,7 @@ Json::Value SkDrawBitmapNineCommand::toJSON(UrlDataManager& urlDataManager) cons
Json::Value encoded;
if (flatten(fBitmap, &encoded, urlDataManager)) {
result[SKDEBUGCANVAS_ATTRIBUTE_BITMAP] = encoded;
- result[SKDEBUGCANVAS_ATTRIBUTE_CENTER] = make_json_irect(fCenter);
+ result[SKDEBUGCANVAS_ATTRIBUTE_CENTER] = MakeJsonIRect(fCenter);
result[SKDEBUGCANVAS_ATTRIBUTE_DST] = make_json_rect(fDst);
if (fPaintPtr != nullptr) {
result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = make_json_paint(*fPaintPtr, urlDataManager);
@@ -2883,7 +2883,7 @@ Json::Value SkDrawTextOnPathCommand::toJSON(UrlDataManager& urlDataManager) cons
Json::Value coords(Json::arrayValue);
result[SKDEBUGCANVAS_ATTRIBUTE_PATH] = make_json_path(fPath);
if (!fMatrix.isIdentity()) {
- result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = make_json_matrix(fMatrix);
+ result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
}
result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = make_json_paint(fPaint, urlDataManager);
return result;
@@ -3105,7 +3105,7 @@ void SkSetMatrixCommand::execute(SkCanvas* canvas) const {
Json::Value SkSetMatrixCommand::toJSON(UrlDataManager& urlDataManager) const {
Json::Value result = INHERITED::toJSON(urlDataManager);
- result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = make_json_matrix(fMatrix);
+ result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
return result;
}
diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h
index 74c2b2c69e..a2835dc6e7 100644
--- a/tools/debugger/SkDrawCommand.h
+++ b/tools/debugger/SkDrawCommand.h
@@ -113,6 +113,10 @@ public:
static const char* GetCommandString(OpType type);
+ // Helper methods for converting things to JSON
+ static Json::Value MakeJsonIRect(const SkIRect&);
+ static Json::Value MakeJsonMatrix(const SkMatrix&);
+
protected:
SkTDArray<SkString*> fInfo;
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 8ffcc36f77..46e3039aad 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -9,8 +9,6 @@
#include "png.h"
-#include "SkJSONCanvas.h"
-
const int Request::kImageWidth = 1920;
const int Request::kImageHeight = 1080;
@@ -228,8 +226,8 @@ SkData* Request::getJsonInfo(int n) {
SkMatrix vm = fDebugCanvas->getCurrentMatrix();
SkIRect clip = fDebugCanvas->getCurrentClip();
Json::Value info(Json::objectValue);
- info["ViewMatrix"] = SkJSONCanvas::MakeMatrix(vm);
- info["ClipRect"] = SkJSONCanvas::MakeIRect(clip);
+ info["ViewMatrix"] = SkDrawCommand::MakeJsonMatrix(vm);
+ info["ClipRect"] = SkDrawCommand::MakeJsonIRect(clip);
std::string json = Json::FastWriter().write(info);