Index: tools/debugger/SkDrawCommand.cpp |
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp |
index 1ef5e0b86c03047a230128c16afe172189289de0..9a78b3f8266140b2287d40fd6eaedfc24198f843 100644 |
--- a/tools/debugger/SkDrawCommand.cpp |
+++ b/tools/debugger/SkDrawCommand.cpp |
@@ -5,7 +5,6 @@ |
* found in the LICENSE file. |
*/ |
- |
#include "SkDrawCommand.h" |
#include "SkBlurMaskFilter.h" |
@@ -25,6 +24,8 @@ |
#include "SkValidatingReadBuffer.h" |
#include "SkWriteBuffer.h" |
+static bool gShowShortDesc = true; |
jcgregorio
2016/06/29 14:43:40
Is this really needed? The display of the short de
reed1
2016/06/29 18:13:45
Done.
|
+ |
#define SKDEBUGCANVAS_ATTRIBUTE_COMMAND "command" |
#define SKDEBUGCANVAS_ATTRIBUTE_VISIBLE "visible" |
#define SKDEBUGCANVAS_ATTRIBUTE_MATRIX "matrix" |
@@ -92,6 +93,8 @@ |
#define SKDEBUGCANVAS_ATTRIBUTE_TEXTURECOORDS "textureCoords" |
#define SKDEBUGCANVAS_ATTRIBUTE_FILTERQUALITY "filterQuality" |
+#define SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC "short-desc" |
+ |
#define SKDEBUGCANVAS_VERB_MOVE "move" |
#define SKDEBUGCANVAS_VERB_LINE "line" |
#define SKDEBUGCANVAS_VERB_QUAD "quad" |
@@ -158,6 +161,11 @@ |
typedef SkDrawCommand* (*FROM_JSON)(Json::Value&, UrlDataManager&); |
+static SkString* str_append(SkString* str, const SkRect& r) { |
+ str->appendf(" [%g %g %g %g]", r.left(), r.top(), r.right(), r.bottom()); |
+ return str; |
+} |
+ |
// TODO(chudy): Refactor into non subclass model. |
SkDrawCommand::SkDrawCommand(OpType type) |
@@ -1643,6 +1651,10 @@ Json::Value SkClipRectCommand::toJSON(UrlDataManager& urlDataManager) const { |
result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect); |
result[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP] = make_json_regionop(fOp); |
result[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS] = Json::Value(fDoAA); |
+ if (gShowShortDesc) { |
+ SkString desc; |
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str()); |
+ } |
return result; |
} |
@@ -1736,6 +1748,11 @@ Json::Value SkDrawAnnotationCommand::toJSON(UrlDataManager& urlDataManager) cons |
if (fValue.get()) { |
// TODO: dump out the "value" |
} |
+ if (gShowShortDesc) { |
+ SkString desc; |
+ str_append(&desc, fRect)->appendf(" %s", fKey.c_str()); |
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(desc.c_str()); |
+ } |
return result; |
} |
@@ -1940,6 +1957,10 @@ Json::Value SkDrawBitmapRectCommand::toJSON(UrlDataManager& urlDataManager) cons |
result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true); |
} |
} |
+ if (gShowShortDesc) { |
+ SkString desc; |
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str()); |
+ } |
return result; |
} |
@@ -2107,6 +2128,10 @@ Json::Value SkDrawImageRectCommand::toJSON(UrlDataManager& urlDataManager) const |
result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true); |
} |
} |
+ if (gShowShortDesc) { |
+ SkString desc; |
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str()); |
+ } |
return result; |
} |
@@ -2781,6 +2806,10 @@ Json::Value SkDrawRectCommand::toJSON(UrlDataManager& urlDataManager) const { |
Json::Value result = INHERITED::toJSON(urlDataManager); |
result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect); |
result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = MakeJsonPaint(fPaint, urlDataManager); |
+ if (gShowShortDesc) { |
+ SkString desc; |
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str()); |
+ } |
return result; |
} |