| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "SkTypeface.h" | 24 #include "SkTypeface.h" |
| 25 #include "SkValidatingReadBuffer.h" | 25 #include "SkValidatingReadBuffer.h" |
| 26 #include "SkWriteBuffer.h" | 26 #include "SkWriteBuffer.h" |
| 27 | 27 |
| 28 #if SK_SUPPORT_GPU | 28 #if SK_SUPPORT_GPU |
| 29 #include "GrContext.h" | 29 #include "GrContext.h" |
| 30 #include "GrRenderTarget.h" | 30 #include "GrRenderTarget.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #define SKDEBUGCANVAS_ATTRIBUTE_COMMAND "command" | 33 #define SKDEBUGCANVAS_ATTRIBUTE_COMMAND "command" |
| 34 #define SKDEBUGCANVAS_ATTRIBUTE_VISIBLE "visible" |
| 34 #define SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL "auditTrail" | 35 #define SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL "auditTrail" |
| 35 #define SKDEBUGCANVAS_ATTRIBUTE_MATRIX "matrix" | 36 #define SKDEBUGCANVAS_ATTRIBUTE_MATRIX "matrix" |
| 36 #define SKDEBUGCANVAS_ATTRIBUTE_COORDS "coords" | 37 #define SKDEBUGCANVAS_ATTRIBUTE_COORDS "coords" |
| 37 #define SKDEBUGCANVAS_ATTRIBUTE_BOUNDS "bounds" | 38 #define SKDEBUGCANVAS_ATTRIBUTE_BOUNDS "bounds" |
| 38 #define SKDEBUGCANVAS_ATTRIBUTE_PAINT "paint" | 39 #define SKDEBUGCANVAS_ATTRIBUTE_PAINT "paint" |
| 39 #define SKDEBUGCANVAS_ATTRIBUTE_OUTER "outer" | 40 #define SKDEBUGCANVAS_ATTRIBUTE_OUTER "outer" |
| 40 #define SKDEBUGCANVAS_ATTRIBUTE_INNER "inner" | 41 #define SKDEBUGCANVAS_ATTRIBUTE_INNER "inner" |
| 41 #define SKDEBUGCANVAS_ATTRIBUTE_MODE "mode" | 42 #define SKDEBUGCANVAS_ATTRIBUTE_MODE "mode" |
| 42 #define SKDEBUGCANVAS_ATTRIBUTE_POINTS "points" | 43 #define SKDEBUGCANVAS_ATTRIBUTE_POINTS "points" |
| 43 #define SKDEBUGCANVAS_ATTRIBUTE_PATH "path" | 44 #define SKDEBUGCANVAS_ATTRIBUTE_PATH "path" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return nullptr; | 216 return nullptr; |
| 216 } | 217 } |
| 217 | 218 |
| 218 SkString SkDrawCommand::toString() const { | 219 SkString SkDrawCommand::toString() const { |
| 219 return SkString(GetCommandString(fOpType)); | 220 return SkString(GetCommandString(fOpType)); |
| 220 } | 221 } |
| 221 | 222 |
| 222 Json::Value SkDrawCommand::toJSON(UrlDataManager& urlDataManager) const { | 223 Json::Value SkDrawCommand::toJSON(UrlDataManager& urlDataManager) const { |
| 223 Json::Value result; | 224 Json::Value result; |
| 224 result[SKDEBUGCANVAS_ATTRIBUTE_COMMAND] = this->GetCommandString(fOpType); | 225 result[SKDEBUGCANVAS_ATTRIBUTE_COMMAND] = this->GetCommandString(fOpType); |
| 226 result[SKDEBUGCANVAS_ATTRIBUTE_VISIBLE] = Json::Value(this->isVisible()); |
| 225 return result; | 227 return result; |
| 226 } | 228 } |
| 227 | 229 |
| 228 Json::Value SkDrawCommand::drawToAndCollectJSON(SkCanvas* canvas, | 230 Json::Value SkDrawCommand::drawToAndCollectJSON(SkCanvas* canvas, |
| 229 UrlDataManager& urlDataManager)
const { | 231 UrlDataManager& urlDataManager)
const { |
| 230 Json::Value result = this->toJSON(urlDataManager); | 232 Json::Value result = this->toJSON(urlDataManager); |
| 231 | 233 |
| 232 SkASSERT(canvas); | 234 SkASSERT(canvas); |
| 233 | 235 |
| 234 #if SK_SUPPORT_GPU | 236 #if SK_SUPPORT_GPU |
| (...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3106 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = make_json_matrix(fMatrix); | 3108 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = make_json_matrix(fMatrix); |
| 3107 return result; | 3109 return result; |
| 3108 } | 3110 } |
| 3109 | 3111 |
| 3110 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3112 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
| 3111 UrlDataManager& urlDataManager)
{ | 3113 UrlDataManager& urlDataManager)
{ |
| 3112 SkMatrix matrix; | 3114 SkMatrix matrix; |
| 3113 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3115 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
| 3114 return new SkSetMatrixCommand(matrix); | 3116 return new SkSetMatrixCommand(matrix); |
| 3115 } | 3117 } |
| OLD | NEW |