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

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: Skip ICO in SkScaledCodec for now 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') | 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 20 matching lines...) Expand all
31 #include "SkBBoxHierarchy.h" 31 #include "SkBBoxHierarchy.h"
32 #include "SkCanvas.h" 32 #include "SkCanvas.h"
33 #include "SkCodec.h" 33 #include "SkCodec.h"
34 #include "SkCommonFlags.h" 34 #include "SkCommonFlags.h"
35 #include "SkData.h" 35 #include "SkData.h"
36 #include "SkForceLinking.h" 36 #include "SkForceLinking.h"
37 #include "SkGraphics.h" 37 #include "SkGraphics.h"
38 #include "SkOSFile.h" 38 #include "SkOSFile.h"
39 #include "SkPictureRecorder.h" 39 #include "SkPictureRecorder.h"
40 #include "SkPictureUtils.h" 40 #include "SkPictureUtils.h"
41 #include "SkScanlineDecoder.h"
42 #include "SkString.h" 41 #include "SkString.h"
43 #include "SkSurface.h" 42 #include "SkSurface.h"
44 #include "SkTaskGroup.h" 43 #include "SkTaskGroup.h"
45 44
46 #include <stdlib.h> 45 #include <stdlib.h>
47 46
48 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 47 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
49 #include "nanobenchAndroid.h" 48 #include "nanobenchAndroid.h"
50 #endif 49 #endif
51 50
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str()); 514 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str());
516 return false; 515 return false;
517 } 516 }
518 517
519 // These will be initialized by SkCodec if the color type is kIndex8 and 518 // These will be initialized by SkCodec if the color type is kIndex8 and
520 // unused otherwise. 519 // unused otherwise.
521 SkPMColor colors[256]; 520 SkPMColor colors[256];
522 int colorCount; 521 int colorCount;
523 const SkImageInfo info = codec->getInfo().makeColorType(colorType); 522 const SkImageInfo info = codec->getInfo().makeColorType(colorType);
524 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]); 523 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
525 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewF romData(encoded)); 524 if (codec->startScanlineDecode(info, nullptr, colors, &colorCount) != Sk Codec::kSuccess)
526 if (nullptr == scanlineDecoder || scanlineDecoder->start(info, nullptr,
527 colors, &colorCount) != SkCodec::kSuccess)
528 { 525 {
529 SkDebugf("Could not create scanline decoder for %s with color type % s. " 526 SkDebugf("Could not create scanline decoder for %s with color type % s. "
530 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy pe)); 527 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy pe));
531 return false; 528 return false;
532 } 529 }
533 *width = info.width(); 530 *width = info.width();
534 *height = info.height(); 531 *height = info.height();
535 } else { 532 } else {
536 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); 533 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
537 if (nullptr == decoder) { 534 if (nullptr == decoder) {
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 1290
1294 return 0; 1291 return 0;
1295 } 1292 }
1296 1293
1297 #if !defined SK_BUILD_FOR_IOS 1294 #if !defined SK_BUILD_FOR_IOS
1298 int main(int argc, char** argv) { 1295 int main(int argc, char** argv) {
1299 SkCommandLineFlags::Parse(argc, argv); 1296 SkCommandLineFlags::Parse(argc, argv);
1300 return nanobench_main(); 1297 return nanobench_main();
1301 } 1298 }
1302 #endif 1299 #endif
OLDNEW
« no previous file with comments | « no previous file | bench/subset/SubsetSingleBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698