* found in the LICENSE file.
*/
-
#include "SkDrawCommand.h"
#include "SkBlurMaskFilter.h"
#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"
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)
result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
result[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP] = make_json_regionop(fOp);
result[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS] = Json::Value(fDoAA);
+
+ SkString desc;
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str());
+
return result;
}
if (fValue.get()) {
// TODO: dump out the "value"
}
+
+ SkString desc;
+ str_append(&desc, fRect)->appendf(" %s", fKey.c_str());
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(desc.c_str());
+
return result;
}
result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true);
}
}
+
+ SkString desc;
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str());
+
return result;
}
result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true);
}
}
+
+ SkString desc;
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str());
+
return result;
}
Json::Value result = INHERITED::toJSON(urlDataManager);
result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = MakeJsonPaint(fPaint, urlDataManager);
+
+ SkString desc;
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str());
+
return result;
}