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

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

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « tests/QuickRejectTest.cpp ('k') | tools/debugger/SkOverdrawMode.cpp » ('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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 } 719 }
720 const char* name = jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_NAME].asCString() ; 720 const char* name = jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_NAME].asCString() ;
721 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(name); 721 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(name);
722 if (factory == nullptr) { 722 if (factory == nullptr) {
723 SkDebugf("no factory for loading '%s'\n", name); 723 SkDebugf("no factory for loading '%s'\n", name);
724 return nullptr; 724 return nullptr;
725 } 725 }
726 const void* data; 726 const void* data;
727 int size = decode_data(jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_DATA], urlDat aManager, &data); 727 int size = decode_data(jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_DATA], urlDat aManager, &data);
728 SkValidatingReadBuffer buffer(data, size); 728 SkValidatingReadBuffer buffer(data, size);
729 SkFlattenable* result = factory(buffer); 729 sk_sp<SkFlattenable> result = factory(buffer);
730 if (!buffer.isValid()) { 730 if (!buffer.isValid()) {
731 SkDebugf("invalid buffer loading flattenable\n"); 731 SkDebugf("invalid buffer loading flattenable\n");
732 return nullptr; 732 return nullptr;
733 } 733 }
734 return result; 734 return result.release();
735 } 735 }
736 736
737 static SkColorType colortype_from_name(const char* name) { 737 static SkColorType colortype_from_name(const char* name) {
738 if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_ARGB4444)) { 738 if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_ARGB4444)) {
739 return kARGB_4444_SkColorType; 739 return kARGB_4444_SkColorType;
740 } 740 }
741 else if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_RGBA8888)) { 741 else if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_RGBA8888)) {
742 return kRGBA_8888_SkColorType; 742 return kRGBA_8888_SkColorType;
743 } 743 }
744 else if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_BGRA8888)) { 744 else if (!strcmp(name, SKDEBUGCANVAS_COLORTYPE_BGRA8888)) {
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); 3127 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix);
3128 return result; 3128 return result;
3129 } 3129 }
3130 3130
3131 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, 3131 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command,
3132 UrlDataManager& urlDataManager) { 3132 UrlDataManager& urlDataManager) {
3133 SkMatrix matrix; 3133 SkMatrix matrix;
3134 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); 3134 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix);
3135 return new SkSetMatrixCommand(matrix); 3135 return new SkSetMatrixCommand(matrix);
3136 } 3136 }
OLDNEW
« no previous file with comments | « tests/QuickRejectTest.cpp ('k') | tools/debugger/SkOverdrawMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698