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

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

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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/Resources.cpp ('k') | tools/sk_tool_utils.h » ('j') | 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 * 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1207 }
1208 1208
1209 static void extract_json_paint_typeface(Json::Value& jsonPaint, UrlDataManager& urlDataManager, 1209 static void extract_json_paint_typeface(Json::Value& jsonPaint, UrlDataManager& urlDataManager,
1210 SkPaint* target) { 1210 SkPaint* target) {
1211 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE)) { 1211 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE)) {
1212 Json::Value jsonTypeface = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE]; 1212 Json::Value jsonTypeface = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE];
1213 Json::Value jsonData = jsonTypeface[SKDEBUGCANVAS_ATTRIBUTE_DATA]; 1213 Json::Value jsonData = jsonTypeface[SKDEBUGCANVAS_ATTRIBUTE_DATA];
1214 const void* data; 1214 const void* data;
1215 Json::ArrayIndex length = decode_data(jsonData, urlDataManager, &data); 1215 Json::ArrayIndex length = decode_data(jsonData, urlDataManager, &data);
1216 SkMemoryStream buffer(data, length); 1216 SkMemoryStream buffer(data, length);
1217 SkTypeface* typeface = SkTypeface::Deserialize(&buffer); 1217 target->setTypeface(SkTypeface::MakeDeserialize(&buffer));
1218 target->setTypeface(typeface);
1219 } 1218 }
1220 } 1219 }
1221 1220
1222 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) { 1221 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) {
1223 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) { 1222 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) {
1224 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString() ; 1223 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString() ;
1225 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) { 1224 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) {
1226 target->setStyle(SkPaint::kFill_Style); 1225 target->setStyle(SkPaint::kFill_Style);
1227 } 1226 }
1228 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) { 1227 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) {
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3133 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); 3132 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
3134 return result; 3133 return result;
3135 } 3134 }
3136 3135
3137 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, 3136 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command,
3138 UrlDataManager& urlDataManager) { 3137 UrlDataManager& urlDataManager) {
3139 SkMatrix matrix; 3138 SkMatrix matrix;
3140 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); 3139 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix);
3141 return new SkSetMatrixCommand(matrix); 3140 return new SkSetMatrixCommand(matrix);
3142 } 3141 }
OLDNEW
« no previous file with comments | « tools/Resources.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698