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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 target->setTypeface(SkTypeface::MakeDeserialize(&buffer)); | 1217 SkTypeface* typeface = SkTypeface::Deserialize(&buffer); |
| 1218 target->setTypeface(typeface); |
1218 } | 1219 } |
1219 } | 1220 } |
1220 | 1221 |
1221 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) { | 1222 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) { |
1222 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) { | 1223 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) { |
1223 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString()
; | 1224 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString()
; |
1224 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) { | 1225 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) { |
1225 target->setStyle(SkPaint::kFill_Style); | 1226 target->setStyle(SkPaint::kFill_Style); |
1226 } | 1227 } |
1227 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) { | 1228 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) { |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3133 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3133 return result; | 3134 return result; |
3134 } | 3135 } |
3135 | 3136 |
3136 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3137 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3137 UrlDataManager& urlDataManager)
{ | 3138 UrlDataManager& urlDataManager)
{ |
3138 SkMatrix matrix; | 3139 SkMatrix matrix; |
3139 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3140 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3140 return new SkSetMatrixCommand(matrix); | 3141 return new SkSetMatrixCommand(matrix); |
3141 } | 3142 } |
OLD | NEW |