OLD | NEW |
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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 if (nullptr != image) { | 762 if (nullptr != image) { |
763 if (!image->asLegacyBitmap(bitmap, SkImage::kRW_LegacyBitmapMode)) { | 763 if (!image->asLegacyBitmap(bitmap, SkImage::kRW_LegacyBitmapMode)) { |
764 SkDebugf("image decode failed\n"); | 764 SkDebugf("image decode failed\n"); |
765 return nullptr; | 765 return nullptr; |
766 } | 766 } |
767 | 767 |
768 if (jsonBitmap.isMember(SKDEBUGCANVAS_ATTRIBUTE_COLOR)) { | 768 if (jsonBitmap.isMember(SKDEBUGCANVAS_ATTRIBUTE_COLOR)) { |
769 const char* ctName = jsonBitmap[SKDEBUGCANVAS_ATTRIBUTE_COLOR].asCSt
ring(); | 769 const char* ctName = jsonBitmap[SKDEBUGCANVAS_ATTRIBUTE_COLOR].asCSt
ring(); |
770 SkColorType ct = colortype_from_name(ctName); | 770 SkColorType ct = colortype_from_name(ctName); |
771 if (ct != kIndex_8_SkColorType) { | 771 if (ct != kIndex_8_SkColorType) { |
772 bitmap.reset(convert_colortype(bitmap.detach(), ct)); | 772 bitmap.reset(convert_colortype(bitmap.release(), ct)); |
773 } | 773 } |
774 } | 774 } |
775 return bitmap.detach(); | 775 return bitmap.release(); |
776 } | 776 } |
777 SkDebugf("image decode failed\n"); | 777 SkDebugf("image decode failed\n"); |
778 return nullptr; | 778 return nullptr; |
779 } | 779 } |
780 | 780 |
781 static SkImage* load_image(const Json::Value& jsonImage, UrlDataManager& urlData
Manager) { | 781 static SkImage* load_image(const Json::Value& jsonImage, UrlDataManager& urlData
Manager) { |
782 SkBitmap* bitmap = load_bitmap(jsonImage, urlDataManager); | 782 SkBitmap* bitmap = load_bitmap(jsonImage, urlDataManager); |
783 if (bitmap == nullptr) { | 783 if (bitmap == nullptr) { |
784 return nullptr; | 784 return nullptr; |
785 } | 785 } |
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3106 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3106 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3107 return result; | 3107 return result; |
3108 } | 3108 } |
3109 | 3109 |
3110 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3110 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3111 UrlDataManager& urlDataManager)
{ | 3111 UrlDataManager& urlDataManager)
{ |
3112 SkMatrix matrix; | 3112 SkMatrix matrix; |
3113 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3113 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3114 return new SkSetMatrixCommand(matrix); | 3114 return new SkSetMatrixCommand(matrix); |
3115 } | 3115 } |
OLD | NEW |