| 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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 static void extract_json_paint_typeface(Json::Value& jsonPaint, UrlDataManager&
urlDataManager, | 1203 static void extract_json_paint_typeface(Json::Value& jsonPaint, UrlDataManager&
urlDataManager, |
| 1204 SkPaint* target) { | 1204 SkPaint* target) { |
| 1205 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE)) { | 1205 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE)) { |
| 1206 Json::Value jsonTypeface = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE]; | 1206 Json::Value jsonTypeface = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_TYPEFACE]; |
| 1207 Json::Value jsonData = jsonTypeface[SKDEBUGCANVAS_ATTRIBUTE_DATA]; | 1207 Json::Value jsonData = jsonTypeface[SKDEBUGCANVAS_ATTRIBUTE_DATA]; |
| 1208 const void* data; | 1208 const void* data; |
| 1209 Json::ArrayIndex length = decode_data(jsonData, urlDataManager, &data); | 1209 Json::ArrayIndex length = decode_data(jsonData, urlDataManager, &data); |
| 1210 SkMemoryStream buffer(data, length); | 1210 SkMemoryStream buffer(data, length); |
| 1211 SkTypeface* typeface = SkTypeface::Deserialize(&buffer); | 1211 target->setTypeface(SkTypeface::MakeDeserialize(&buffer)); |
| 1212 target->setTypeface(typeface); | |
| 1213 } | 1212 } |
| 1214 } | 1213 } |
| 1215 | 1214 |
| 1216 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) { | 1215 static void extract_json_paint_style(Json::Value& jsonPaint, SkPaint* target) { |
| 1217 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) { | 1216 if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_STYLE)) { |
| 1218 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString()
; | 1217 const char* style = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_STYLE].asCString()
; |
| 1219 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) { | 1218 if (!strcmp(style, SKDEBUGCANVAS_STYLE_FILL)) { |
| 1220 target->setStyle(SkPaint::kFill_Style); | 1219 target->setStyle(SkPaint::kFill_Style); |
| 1221 } | 1220 } |
| 1222 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) { | 1221 else if (!strcmp(style, SKDEBUGCANVAS_STYLE_STROKE)) { |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3126 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
| 3128 return result; | 3127 return result; |
| 3129 } | 3128 } |
| 3130 | 3129 |
| 3131 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3130 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
| 3132 UrlDataManager& urlDataManager)
{ | 3131 UrlDataManager& urlDataManager)
{ |
| 3133 SkMatrix matrix; | 3132 SkMatrix matrix; |
| 3134 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3133 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
| 3135 return new SkSetMatrixCommand(matrix); | 3134 return new SkSetMatrixCommand(matrix); |
| 3136 } | 3135 } |
| OLD | NEW |