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

Side by Side Diff: bench/nanobench.cpp

Issue 1220733013: SkCodec no longer inherits from SkImageGenerator. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Manually handle the lifetime of fScanlineDecoder. Created 5 years, 5 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 | « bench/CodecBench.cpp ('k') | bench/subset/SubsetSingleBench.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 2014 Google Inc. 2 * Copyright 2014 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 #include <ctype.h> 8 #include <ctype.h>
9 9
10 #include "nanobench.h" 10 #include "nanobench.h"
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 info = info.makeAlphaType(alphaType); 773 info = info.makeAlphaType(alphaType);
774 } 774 }
775 775
776 const size_t rowBytes = info.minRowBytes(); 776 const size_t rowBytes = info.minRowBytes();
777 SkAutoMalloc storage(info.getSafeSize(rowBytes)); 777 SkAutoMalloc storage(info.getSafeSize(rowBytes));
778 778
779 // Used if fCurrentColorType is kIndex_8_SkColorType 779 // Used if fCurrentColorType is kIndex_8_SkColorType
780 int colorCount = 256; 780 int colorCount = 256;
781 SkPMColor colors[256]; 781 SkPMColor colors[256];
782 782
783 const SkImageGenerator::Result result = codec->getPixels( 783 const SkCodec::Result result = codec->getPixels(
784 info, storage.get(), rowBytes, NULL, colors, 784 info, storage.get(), rowBytes, NULL, colors,
785 &colorCount); 785 &colorCount);
786 switch (result) { 786 switch (result) {
787 case SkImageGenerator::kSuccess: 787 case SkCodec::kSuccess:
788 case SkImageGenerator::kIncompleteInput: 788 case SkCodec::kIncompleteInput:
789 return new CodecBench(SkOSPath::Basename(path.c_str()), 789 return new CodecBench(SkOSPath::Basename(path.c_str()),
790 encoded, colorType); 790 encoded, colorType);
791 case SkImageGenerator::kInvalidConversion: 791 case SkCodec::kInvalidConversion:
792 // This is okay. Not all conversions are valid. 792 // This is okay. Not all conversions are valid.
793 break; 793 break;
794 default: 794 default:
795 // This represents some sort of failure. 795 // This represents some sort of failure.
796 SkASSERT(false); 796 SkASSERT(false);
797 break; 797 break;
798 } 798 }
799 } 799 }
800 fCurrentColorType = 0; 800 fCurrentColorType = 0;
801 } 801 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1154
1155 return 0; 1155 return 0;
1156 } 1156 }
1157 1157
1158 #if !defined SK_BUILD_FOR_IOS 1158 #if !defined SK_BUILD_FOR_IOS
1159 int main(int argc, char** argv) { 1159 int main(int argc, char** argv) {
1160 SkCommandLineFlags::Parse(argc, argv); 1160 SkCommandLineFlags::Parse(argc, argv);
1161 return nanobench_main(); 1161 return nanobench_main();
1162 } 1162 }
1163 #endif 1163 #endif
OLDNEW
« no previous file with comments | « bench/CodecBench.cpp ('k') | bench/subset/SubsetSingleBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698