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

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

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 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 | « tools/VisualBench/VisualBenchmarkStream.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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698