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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 if (pathEffect != nullptr) { | 1138 if (pathEffect != nullptr) { |
1139 target->setPathEffect(pathEffect); | 1139 target->setPathEffect(pathEffect); |
1140 } | 1140 } |
1141 } | 1141 } |
1142 } | 1142 } |
1143 | 1143 |
1144 static void extract_json_paint_maskfilter(Json::Value& jsonPaint, UrlDataManager
& urlDataManager, | 1144 static void extract_json_paint_maskfilter(Json::Value& jsonPaint, UrlDataManager
& urlDataManager, |
1145 SkPaint* target) { | 1145 SkPaint* target) { |
1146 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_MASKFILTER)) { | 1146 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_MASKFILTER)) { |
1147 Json::Value jsonMaskFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_MASKFILTE
R]; | 1147 Json::Value jsonMaskFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_MASKFILTE
R]; |
1148 SkMaskFilter* maskFilter = (SkMaskFilter*) load_flattenable(jsonMaskFilt
er, urlDataManager); | 1148 sk_sp<SkMaskFilter> maskFilter((SkMaskFilter*)load_flattenable(jsonMaskF
ilter, |
1149 if (maskFilter != nullptr) { | 1149 urlDataMa
nager)); |
1150 target->setMaskFilter(maskFilter); | 1150 if (maskFilter) { |
1151 maskFilter->unref(); | 1151 target->setMaskFilter(std::move(maskFilter)); |
1152 } | 1152 } |
1153 } | 1153 } |
1154 } | 1154 } |
1155 | 1155 |
1156 static void extract_json_paint_colorfilter(Json::Value& jsonPaint, UrlDataManage
r& urlDataManager, | 1156 static void extract_json_paint_colorfilter(Json::Value& jsonPaint, UrlDataManage
r& urlDataManager, |
1157 SkPaint* target) { | 1157 SkPaint* target) { |
1158 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_COLORFILTER)) { | 1158 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_COLORFILTER)) { |
1159 Json::Value jsonColorFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_COLORFIL
TER]; | 1159 Json::Value jsonColorFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_COLORFIL
TER]; |
1160 sk_sp<SkColorFilter> colorFilter((SkColorFilter*)load_flattenable(jsonCo
lorFilter, | 1160 sk_sp<SkColorFilter> colorFilter((SkColorFilter*)load_flattenable(jsonCo
lorFilter, |
1161 urlDat
aManager)); | 1161 urlDat
aManager)); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_LOW)) { | 1332 if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_LOW)) { |
1333 flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag; | 1333 flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag; |
1334 } | 1334 } |
1335 else if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_HIGH)) { | 1335 else if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_HIGH)) { |
1336 flags = SkBlurMaskFilter::BlurFlags::kHighQuality_BlurFlag; | 1336 flags = SkBlurMaskFilter::BlurFlags::kHighQuality_BlurFlag; |
1337 } | 1337 } |
1338 else { | 1338 else { |
1339 SkASSERT(false); | 1339 SkASSERT(false); |
1340 flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag; | 1340 flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag; |
1341 } | 1341 } |
1342 target->setMaskFilter(SkBlurMaskFilter::Create(style, sigma, flags)); | 1342 target->setMaskFilter(SkBlurMaskFilter::Make(style, sigma, flags)); |
1343 } | 1343 } |
1344 } | 1344 } |
1345 | 1345 |
1346 static void extract_json_paint_dashing(Json::Value& jsonPaint, SkPaint* target)
{ | 1346 static void extract_json_paint_dashing(Json::Value& jsonPaint, SkPaint* target)
{ |
1347 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_DASHING)) { | 1347 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_DASHING)) { |
1348 Json::Value dash = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_DASHING]; | 1348 Json::Value dash = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_DASHING]; |
1349 Json::Value jsonIntervals = dash[SKDEBUGCANVAS_ATTRIBUTE_INTERVALS]; | 1349 Json::Value jsonIntervals = dash[SKDEBUGCANVAS_ATTRIBUTE_INTERVALS]; |
1350 Json::ArrayIndex count = jsonIntervals.size(); | 1350 Json::ArrayIndex count = jsonIntervals.size(); |
1351 SkScalar* intervals = (SkScalar*) sk_malloc_throw(count * sizeof(SkScala
r)); | 1351 SkScalar* intervals = (SkScalar*) sk_malloc_throw(count * sizeof(SkScala
r)); |
1352 for (Json::ArrayIndex i = 0; i < count; i++) { | 1352 for (Json::ArrayIndex i = 0; i < count; i++) { |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3127 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3128 return result; | 3128 return result; |
3129 } | 3129 } |
3130 | 3130 |
3131 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3131 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3132 UrlDataManager& urlDataManager)
{ | 3132 UrlDataManager& urlDataManager)
{ |
3133 SkMatrix matrix; | 3133 SkMatrix matrix; |
3134 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3134 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3135 return new SkSetMatrixCommand(matrix); | 3135 return new SkSetMatrixCommand(matrix); |
3136 } | 3136 } |
OLD | NEW |