Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Side by Side Diff: tools/debugger/SkDrawCommand.cpp

Issue 1817543002: Revert of switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 target->setShader(shader); 1099 target->setShader(shader);
1100 shader->unref(); 1100 shader->unref();
1101 } 1101 }
1102 } 1102 }
1103 } 1103 }
1104 1104
1105 static void extract_json_paint_patheffect(Json::Value& jsonPaint, UrlDataManager & urlDataManager, 1105 static void extract_json_paint_patheffect(Json::Value& jsonPaint, UrlDataManager & urlDataManager,
1106 SkPaint* target) { 1106 SkPaint* target) {
1107 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_PATHEFFECT)) { 1107 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_PATHEFFECT)) {
1108 Json::Value jsonPathEffect = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_PATHEFFEC T]; 1108 Json::Value jsonPathEffect = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_PATHEFFEC T];
1109 sk_sp<SkPathEffect> pathEffect((SkPathEffect*)load_flattenable(jsonPathE ffect, 1109 SkPathEffect* pathEffect = (SkPathEffect*) load_flattenable(jsonPathEffe ct, urlDataManager);
1110 urlDataMa nager));
1111 if (pathEffect != nullptr) { 1110 if (pathEffect != nullptr) {
1112 target->setPathEffect(pathEffect); 1111 target->setPathEffect(pathEffect);
1112 pathEffect->unref();
1113 } 1113 }
1114 } 1114 }
1115 } 1115 }
1116 1116
1117 static void extract_json_paint_maskfilter(Json::Value& jsonPaint, UrlDataManager & urlDataManager, 1117 static void extract_json_paint_maskfilter(Json::Value& jsonPaint, UrlDataManager & urlDataManager,
1118 SkPaint* target) { 1118 SkPaint* target) {
1119 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_MASKFILTER)) { 1119 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_MASKFILTER)) {
1120 Json::Value jsonMaskFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_MASKFILTE R]; 1120 Json::Value jsonMaskFilter = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_MASKFILTE R];
1121 SkMaskFilter* maskFilter = (SkMaskFilter*) load_flattenable(jsonMaskFilt er, urlDataManager); 1121 SkMaskFilter* maskFilter = (SkMaskFilter*) load_flattenable(jsonMaskFilt er, urlDataManager);
1122 if (maskFilter != nullptr) { 1122 if (maskFilter != nullptr) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 static void extract_json_paint_dashing(Json::Value& jsonPaint, SkPaint* target) { 1322 static void extract_json_paint_dashing(Json::Value& jsonPaint, SkPaint* target) {
1323 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_DASHING)) { 1323 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_DASHING)) {
1324 Json::Value dash = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_DASHING]; 1324 Json::Value dash = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_DASHING];
1325 Json::Value jsonIntervals = dash[SKDEBUGCANVAS_ATTRIBUTE_INTERVALS]; 1325 Json::Value jsonIntervals = dash[SKDEBUGCANVAS_ATTRIBUTE_INTERVALS];
1326 Json::ArrayIndex count = jsonIntervals.size(); 1326 Json::ArrayIndex count = jsonIntervals.size();
1327 SkScalar* intervals = (SkScalar*) sk_malloc_throw(count * sizeof(SkScala r)); 1327 SkScalar* intervals = (SkScalar*) sk_malloc_throw(count * sizeof(SkScala r));
1328 for (Json::ArrayIndex i = 0; i < count; i++) { 1328 for (Json::ArrayIndex i = 0; i < count; i++) {
1329 intervals[i] = jsonIntervals[i].asFloat(); 1329 intervals[i] = jsonIntervals[i].asFloat();
1330 } 1330 }
1331 SkScalar phase = dash[SKDEBUGCANVAS_ATTRIBUTE_PHASE].asFloat(); 1331 SkScalar phase = dash[SKDEBUGCANVAS_ATTRIBUTE_PHASE].asFloat();
1332 target->setPathEffect(SkDashPathEffect::Make(intervals, count, phase)); 1332 target->setPathEffect(SkDashPathEffect::Create(intervals, count, phase)) ;
1333 sk_free(intervals); 1333 sk_free(intervals);
1334 } 1334 }
1335 } 1335 }
1336 1336
1337 static void extract_json_paint_textalign(Json::Value& jsonPaint, SkPaint* target ) { 1337 static void extract_json_paint_textalign(Json::Value& jsonPaint, SkPaint* target ) {
1338 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TEXTALIGN)) { 1338 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TEXTALIGN)) {
1339 SkPaint::Align textAlign; 1339 SkPaint::Align textAlign;
1340 const char* jsonAlign = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TEXTALIGN].asC String(); 1340 const char* jsonAlign = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TEXTALIGN].asC String();
1341 if (!strcmp(jsonAlign, SKDEBUGCANVAS_ALIGN_LEFT)) { 1341 if (!strcmp(jsonAlign, SKDEBUGCANVAS_ALIGN_LEFT)) {
1342 textAlign = SkPaint::kLeft_Align; 1342 textAlign = SkPaint::kLeft_Align;
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); 3103 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
3104 return result; 3104 return result;
3105 } 3105 }
3106 3106
3107 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, 3107 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command,
3108 UrlDataManager& urlDataManager) { 3108 UrlDataManager& urlDataManager) {
3109 SkMatrix matrix; 3109 SkMatrix matrix;
3110 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); 3110 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix);
3111 return new SkSetMatrixCommand(matrix); 3111 return new SkSetMatrixCommand(matrix);
3112 } 3112 }
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698