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

Side by Side Diff: tools/debugger/SkDrawCommand.cpp

Issue 2110083002: Add Annotations to old debugger (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "SkDrawCommand.h" 9 #include "SkDrawCommand.h"
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 const char* SkDrawCommand::GetCommandString(OpType type) { 172 const char* SkDrawCommand::GetCommandString(OpType type) {
173 switch (type) { 173 switch (type) {
174 case kBeginDrawPicture_OpType: return "BeginDrawPicture"; 174 case kBeginDrawPicture_OpType: return "BeginDrawPicture";
175 case kClipPath_OpType: return "ClipPath"; 175 case kClipPath_OpType: return "ClipPath";
176 case kClipRegion_OpType: return "ClipRegion"; 176 case kClipRegion_OpType: return "ClipRegion";
177 case kClipRect_OpType: return "ClipRect"; 177 case kClipRect_OpType: return "ClipRect";
178 case kClipRRect_OpType: return "ClipRRect"; 178 case kClipRRect_OpType: return "ClipRRect";
179 case kConcat_OpType: return "Concat"; 179 case kConcat_OpType: return "Concat";
180 case kDrawAnnotation_OpType: return "drawAnnotation"; 180 case kDrawAnnotation_OpType: return "DrawAnnotation";
181 case kDrawBitmap_OpType: return "DrawBitmap"; 181 case kDrawBitmap_OpType: return "DrawBitmap";
182 case kDrawBitmapNine_OpType: return "DrawBitmapNine"; 182 case kDrawBitmapNine_OpType: return "DrawBitmapNine";
183 case kDrawBitmapRect_OpType: return "DrawBitmapRect"; 183 case kDrawBitmapRect_OpType: return "DrawBitmapRect";
184 case kDrawClear_OpType: return "DrawClear"; 184 case kDrawClear_OpType: return "DrawClear";
185 case kDrawDRRect_OpType: return "DrawDRRect"; 185 case kDrawDRRect_OpType: return "DrawDRRect";
186 case kDrawImage_OpType: return "DrawImage"; 186 case kDrawImage_OpType: return "DrawImage";
187 case kDrawImageRect_OpType: return "DrawImageRect"; 187 case kDrawImageRect_OpType: return "DrawImageRect";
188 case kDrawOval_OpType: return "DrawOval"; 188 case kDrawOval_OpType: return "DrawOval";
189 case kDrawPaint_OpType: return "DrawPaint"; 189 case kDrawPaint_OpType: return "DrawPaint";
190 case kDrawPatch_OpType: return "DrawPatch"; 190 case kDrawPatch_OpType: return "DrawPatch";
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 } 1715 }
1716 1716
1717 //// 1717 ////
1718 1718
1719 SkDrawAnnotationCommand::SkDrawAnnotationCommand(const SkRect& rect, const char key[], 1719 SkDrawAnnotationCommand::SkDrawAnnotationCommand(const SkRect& rect, const char key[],
1720 sk_sp<SkData> value) 1720 sk_sp<SkData> value)
1721 : INHERITED(kDrawAnnotation_OpType) 1721 : INHERITED(kDrawAnnotation_OpType)
1722 , fRect(rect) 1722 , fRect(rect)
1723 , fKey(key) 1723 , fKey(key)
1724 , fValue(std::move(value)) 1724 , fValue(std::move(value))
1725 {} 1725 {
1726 SkString str;
1727 str.appendf("Key: %s Value: ", key);
1728 if (fValue && fValue->size()) {
1729 str.append((const char*) fValue->bytes(), fValue->size());
1730 } else {
1731 str.appendf("no value");
1732 }
1733 str.appendf("\n");
1734 fInfo.push(new SkString(str));
1735 }
1726 1736
1727 void SkDrawAnnotationCommand::execute(SkCanvas* canvas) const { 1737 void SkDrawAnnotationCommand::execute(SkCanvas* canvas) const {
1728 canvas->drawAnnotation(fRect, fKey.c_str(), fValue); 1738 canvas->drawAnnotation(fRect, fKey.c_str(), fValue);
1729 } 1739 }
1730 1740
1731 Json::Value SkDrawAnnotationCommand::toJSON(UrlDataManager& urlDataManager) cons t { 1741 Json::Value SkDrawAnnotationCommand::toJSON(UrlDataManager& urlDataManager) cons t {
1732 Json::Value result = INHERITED::toJSON(urlDataManager); 1742 Json::Value result = INHERITED::toJSON(urlDataManager);
1733 1743
1734 result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect); 1744 result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
1735 result["key"] = Json::Value(fKey.c_str()); 1745 result["key"] = Json::Value(fKey.c_str());
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); 3179 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
3170 return result; 3180 return result;
3171 } 3181 }
3172 3182
3173 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, 3183 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command,
3174 UrlDataManager& urlDataManager) { 3184 UrlDataManager& urlDataManager) {
3175 SkMatrix matrix; 3185 SkMatrix matrix;
3176 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); 3186 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix);
3177 return new SkSetMatrixCommand(matrix); 3187 return new SkSetMatrixCommand(matrix);
3178 } 3188 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698