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