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

Side by Side Diff: bench/nanobench.cpp

Issue 1365313002: Merge SkCodec with SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | bench/subset/SubsetSingleBench.cpp » ('j') | include/codec/SkCodec.h » ('J')
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 18 matching lines...) Expand all
29 #include "SkBBoxHierarchy.h" 29 #include "SkBBoxHierarchy.h"
30 #include "SkCanvas.h" 30 #include "SkCanvas.h"
31 #include "SkCodec.h" 31 #include "SkCodec.h"
32 #include "SkCommonFlags.h" 32 #include "SkCommonFlags.h"
33 #include "SkData.h" 33 #include "SkData.h"
34 #include "SkForceLinking.h" 34 #include "SkForceLinking.h"
35 #include "SkGraphics.h" 35 #include "SkGraphics.h"
36 #include "SkOSFile.h" 36 #include "SkOSFile.h"
37 #include "SkPictureRecorder.h" 37 #include "SkPictureRecorder.h"
38 #include "SkPictureUtils.h" 38 #include "SkPictureUtils.h"
39 #include "SkScanlineDecoder.h"
40 #include "SkString.h" 39 #include "SkString.h"
41 #include "SkSurface.h" 40 #include "SkSurface.h"
42 #include "SkTaskGroup.h" 41 #include "SkTaskGroup.h"
43 42
44 #include <stdlib.h> 43 #include <stdlib.h>
45 44
46 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 45 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
47 #include "nanobenchAndroid.h" 46 #include "nanobenchAndroid.h"
48 #endif 47 #endif
49 48
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str()); 512 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str());
514 return false; 513 return false;
515 } 514 }
516 515
517 // These will be initialized by SkCodec if the color type is kIndex8 and 516 // These will be initialized by SkCodec if the color type is kIndex8 and
518 // unused otherwise. 517 // unused otherwise.
519 SkPMColor colors[256]; 518 SkPMColor colors[256];
520 int colorCount; 519 int colorCount;
521 const SkImageInfo info = codec->getInfo().makeColorType(colorType); 520 const SkImageInfo info = codec->getInfo().makeColorType(colorType);
522 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]); 521 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
523 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewF romData(encoded)); 522 if (codec->start(info, nullptr, colors, &colorCount) != SkCodec::kSucces s)
524 if (nullptr == scanlineDecoder || scanlineDecoder->start(info, nullptr,
525 colors, &colorCount) != SkCodec::kSuccess)
526 { 523 {
527 SkDebugf("Could not create scanline decoder for %s with color type % s. " 524 SkDebugf("Could not create scanline decoder for %s with color type % s. "
528 "Skipping bench.\n", path.c_str(), get_color_name(colorType) ); 525 "Skipping bench.\n", path.c_str(), get_color_name(colorType) );
529 return false; 526 return false;
530 } 527 }
531 *width = info.width(); 528 *width = info.width();
532 *height = info.height(); 529 *height = info.height();
533 } else { 530 } else {
534 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); 531 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
535 if (nullptr == decoder) { 532 if (nullptr == decoder) {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1158
1162 return 0; 1159 return 0;
1163 } 1160 }
1164 1161
1165 #if !defined SK_BUILD_FOR_IOS 1162 #if !defined SK_BUILD_FOR_IOS
1166 int main(int argc, char** argv) { 1163 int main(int argc, char** argv) {
1167 SkCommandLineFlags::Parse(argc, argv); 1164 SkCommandLineFlags::Parse(argc, argv);
1168 return nanobench_main(); 1165 return nanobench_main();
1169 } 1166 }
1170 #endif 1167 #endif
OLDNEW
« no previous file with comments | « no previous file | bench/subset/SubsetSingleBench.cpp » ('j') | include/codec/SkCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698