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

Unified Diff: tools/debugger/SkDrawCommand.cpp

Issue 2105113002: add annotations to debugger (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/debugger/SkDrawCommand.cpp
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index b95a9b89d1753c785db85a0296535669e1501301..45f58ddeea35e686fc2646b253a55d345b13e53e 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -177,6 +177,7 @@ const char* SkDrawCommand::GetCommandString(OpType type) {
case kClipRect_OpType: return "ClipRect";
case kClipRRect_OpType: return "ClipRRect";
case kConcat_OpType: return "Concat";
+ case kDrawAnnotation_OpType: return "drawAnnotation";
case kDrawBitmap_OpType: return "DrawBitmap";
case kDrawBitmapNine_OpType: return "DrawBitmapNine";
case kDrawBitmapRect_OpType: return "DrawBitmapRect";
@@ -235,6 +236,7 @@ SkDrawCommand* SkDrawCommand::fromJSON(Json::Value& command, UrlDataManager& url
INSTALL_FACTORY(ClipRect);
INSTALL_FACTORY(ClipRRect);
INSTALL_FACTORY(Concat);
+ INSTALL_FACTORY(DrawAnnotation);
INSTALL_FACTORY(DrawBitmap);
INSTALL_FACTORY(DrawBitmapRect);
INSTALL_FACTORY(DrawBitmapNine);
@@ -1712,6 +1714,46 @@ SkConcatCommand* SkConcatCommand::fromJSON(Json::Value& command, UrlDataManager&
return new SkConcatCommand(matrix);
}
+////
+
+SkDrawAnnotationCommand::SkDrawAnnotationCommand(const SkRect& rect, const char key[],
+ sk_sp<SkData> value)
+ : INHERITED(kDrawAnnotation_OpType)
+ , fRect(rect)
+ , fKey(key)
+ , fValue(std::move(value))
+{
+}
+
+void SkDrawAnnotationCommand::execute(SkCanvas* canvas) const {
+ canvas->drawAnnotation(fRect, fKey.c_str(), fValue);
+}
+
robertphillips 2016/06/28 21:30:37 You can just remove this override from this class
reed1 2016/06/29 01:40:00 Done.
+bool SkDrawAnnotationCommand::render(SkCanvas* canvas) const {
+// render_bitmap(canvas, fBitmap);
+ return true;
+}
+
+Json::Value SkDrawAnnotationCommand::toJSON(UrlDataManager& urlDataManager) const {
+ Json::Value result = INHERITED::toJSON(urlDataManager);
+
+ result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
+ result["key"] = Json::Value(fKey.c_str());
+ if (fValue.get()) {
+// result["value"] = encoded;
+ }
+ return result;
+}
+
+SkDrawAnnotationCommand* SkDrawAnnotationCommand::fromJSON(Json::Value& command,
robertphillips 2016/06/28 21:30:37 line this up ?
reed1 2016/06/29 01:40:00 Done.
+ UrlDataManager& urlDataManager) {
+ SkRect rect;
+ extract_json_rect(command[SKDEBUGCANVAS_ATTRIBUTE_COORDS], &rect);
robertphillips 2016/06/28 21:30:37 nullptr seems less than optimal here
reed1 2016/06/29 01:40:00 Not sure what you mean. Added a TODO to in the fut
+ return new SkDrawAnnotationCommand(rect, command["key"].asCString(), nullptr);
+}
+
+////
+
SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint)
: INHERITED(kDrawBitmap_OpType) {
« no previous file with comments | « tools/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698