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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 if (colorFilter != nullptr) { | 1163 if (colorFilter != nullptr) { |
1164 target->setColorFilter(colorFilter); | 1164 target->setColorFilter(colorFilter); |
1165 } | 1165 } |
1166 } | 1166 } |
1167 } | 1167 } |
1168 | 1168 |
1169 static void extract_json_paint_xfermode(Json::Value& jsonPaint, UrlDataManager&
urlDataManager, | 1169 static void extract_json_paint_xfermode(Json::Value& jsonPaint, UrlDataManager&
urlDataManager, |
1170 SkPaint* target) { | 1170 SkPaint* target) { |
1171 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_XFERMODE)) { | 1171 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_XFERMODE)) { |
1172 Json::Value jsonXfermode = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_XFERMODE]; | 1172 Json::Value jsonXfermode = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_XFERMODE]; |
1173 SkXfermode* xfermode = (SkXfermode*) load_flattenable(jsonXfermode, urlD
ataManager); | 1173 sk_sp<SkXfermode> xfermode((SkXfermode*) load_flattenable(jsonXfermode,
urlDataManager)); |
1174 if (xfermode != nullptr) { | 1174 if (xfermode != nullptr) { |
1175 target->setXfermode(xfermode); | 1175 target->setXfermode(xfermode); |
1176 xfermode->unref(); | |
1177 } | 1176 } |
1178 } | 1177 } |
1179 } | 1178 } |
1180 | 1179 |
1181 static void extract_json_paint_looper(Json::Value& jsonPaint, UrlDataManager& ur
lDataManager, | 1180 static void extract_json_paint_looper(Json::Value& jsonPaint, UrlDataManager& ur
lDataManager, |
1182 SkPaint* target) { | 1181 SkPaint* target) { |
1183 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_LOOPER)) { | 1182 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_LOOPER)) { |
1184 Json::Value jsonLooper = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_LOOPER]; | 1183 Json::Value jsonLooper = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_LOOPER]; |
1185 sk_sp<SkDrawLooper> looper((SkDrawLooper*) load_flattenable(jsonLooper,
urlDataManager)); | 1184 sk_sp<SkDrawLooper> looper((SkDrawLooper*) load_flattenable(jsonLooper,
urlDataManager)); |
1186 if (looper != nullptr) { | 1185 if (looper != nullptr) { |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3128 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3130 return result; | 3129 return result; |
3131 } | 3130 } |
3132 | 3131 |
3133 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3132 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3134 UrlDataManager& urlDataManager)
{ | 3133 UrlDataManager& urlDataManager)
{ |
3135 SkMatrix matrix; | 3134 SkMatrix matrix; |
3136 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3135 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3137 return new SkSetMatrixCommand(matrix); | 3136 return new SkSetMatrixCommand(matrix); |
3138 } | 3137 } |
OLD | NEW |