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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 target->setColor(get_json_color(jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_COLOR]
)); | 1118 target->setColor(get_json_color(jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_COLOR]
)); |
1119 } | 1119 } |
1120 } | 1120 } |
1121 | 1121 |
1122 static void extract_json_paint_shader(Json::Value& jsonPaint, UrlDataManager& ur
lDataManager, | 1122 static void extract_json_paint_shader(Json::Value& jsonPaint, UrlDataManager& ur
lDataManager, |
1123 SkPaint* target) { | 1123 SkPaint* target) { |
1124 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_SHADER)) { | 1124 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_SHADER)) { |
1125 Json::Value jsonShader = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_SHADER]; | 1125 Json::Value jsonShader = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_SHADER]; |
1126 SkShader* shader = (SkShader*) load_flattenable(jsonShader, urlDataManag
er); | 1126 SkShader* shader = (SkShader*) load_flattenable(jsonShader, urlDataManag
er); |
1127 if (shader != nullptr) { | 1127 if (shader != nullptr) { |
1128 target->setShader(shader); | 1128 target->setShader(sk_ref_sp(shader)); |
1129 shader->unref(); | |
1130 } | 1129 } |
1131 } | 1130 } |
1132 } | 1131 } |
1133 | 1132 |
1134 static void extract_json_paint_patheffect(Json::Value& jsonPaint, UrlDataManager
& urlDataManager, | 1133 static void extract_json_paint_patheffect(Json::Value& jsonPaint, UrlDataManager
& urlDataManager, |
1135 SkPaint* target) { | 1134 SkPaint* target) { |
1136 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_PATHEFFECT)) { | 1135 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_PATHEFFECT)) { |
1137 Json::Value jsonPathEffect = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_PATHEFFEC
T]; | 1136 Json::Value jsonPathEffect = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_PATHEFFEC
T]; |
1138 sk_sp<SkPathEffect> pathEffect((SkPathEffect*)load_flattenable(jsonPathE
ffect, | 1137 sk_sp<SkPathEffect> pathEffect((SkPathEffect*)load_flattenable(jsonPathE
ffect, |
1139 urlDataMa
nager)); | 1138 urlDataMa
nager)); |
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3129 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3131 return result; | 3130 return result; |
3132 } | 3131 } |
3133 | 3132 |
3134 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3133 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3135 UrlDataManager& urlDataManager)
{ | 3134 UrlDataManager& urlDataManager)
{ |
3136 SkMatrix matrix; | 3135 SkMatrix matrix; |
3137 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3136 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3138 return new SkSetMatrixCommand(matrix); | 3137 return new SkSetMatrixCommand(matrix); |
3139 } | 3138 } |
OLD | NEW |