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

Side by Side Diff: bench/nanobench.cpp

Issue 1408593002: Remove unnecessary allocation in nanobench (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 | no next file » | 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if (nullptr == codec) { 548 if (nullptr == codec) {
549 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str()); 549 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c _str());
550 return false; 550 return false;
551 } 551 }
552 552
553 // These will be initialized by SkCodec if the color type is kIndex8 and 553 // These will be initialized by SkCodec if the color type is kIndex8 and
554 // unused otherwise. 554 // unused otherwise.
555 SkPMColor colors[256]; 555 SkPMColor colors[256];
556 int colorCount; 556 int colorCount;
557 const SkImageInfo info = codec->getInfo().makeColorType(colorType); 557 const SkImageInfo info = codec->getInfo().makeColorType(colorType);
558 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
559 if (codec->startScanlineDecode(info, nullptr, colors, &colorCount) != Sk Codec::kSuccess) 558 if (codec->startScanlineDecode(info, nullptr, colors, &colorCount) != Sk Codec::kSuccess)
560 { 559 {
561 SkDebugf("Could not create scanline decoder for %s with color type % s. " 560 SkDebugf("Could not create scanline decoder for %s with color type % s. "
562 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy pe)); 561 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy pe));
563 return false; 562 return false;
564 } 563 }
565 *width = info.width(); 564 *width = info.width();
566 *height = info.height(); 565 *height = info.height();
567 } else { 566 } else {
568 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); 567 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 1338
1340 return 0; 1339 return 0;
1341 } 1340 }
1342 1341
1343 #if !defined SK_BUILD_FOR_IOS 1342 #if !defined SK_BUILD_FOR_IOS
1344 int main(int argc, char** argv) { 1343 int main(int argc, char** argv) {
1345 SkCommandLineFlags::Parse(argc, argv); 1344 SkCommandLineFlags::Parse(argc, argv);
1346 return nanobench_main(); 1345 return nanobench_main();
1347 } 1346 }
1348 #endif 1347 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698