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

Side by Side Diff: bench/subset/SubsetSingleBench.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/subset/SubsetBenchPriv.h ('k') | bench/subset/SubsetTranslateBench.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 2015 Google Inc. 2 * Copyright 2015 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 "SubsetSingleBench.h" 8 #include "SubsetSingleBench.h"
9 #include "SubsetBenchPriv.h" 9 #include "SubsetBenchPriv.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) { 60 void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) {
61 // When the color type is kIndex8, we will need to store the color table. I f it is 61 // When the color type is kIndex8, we will need to store the color table. I f it is
62 // used, it will be initialized by the codec. 62 // used, it will be initialized by the codec.
63 int colorCount; 63 int colorCount;
64 SkPMColor colors[256]; 64 SkPMColor colors[256];
65 if (fUseCodec) { 65 if (fUseCodec) {
66 for (int count = 0; count < n; count++) { 66 for (int count = 0; count < n; count++) {
67 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( 67 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
68 SkScanlineDecoder::NewFromStream(fStream->duplicate())); 68 SkScanlineDecoder::NewFromStream(fStream->duplicate()));
69 const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fC olorType); 69 const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fC olorType);
70 SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowByte s())); 70 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
71 scanlineDecoder->start(info, NULL, colors, &colorCount); 71 scanlineDecoder->start(info, NULL, colors, &colorCount);
72 72
73 SkBitmap bitmap; 73 SkBitmap bitmap;
74 SkImageInfo subsetInfo = info.makeWH(fSubsetWidth, fSubsetHeight); 74 SkImageInfo subsetInfo = info.makeWH(fSubsetWidth, fSubsetHeight);
75 alloc_pixels(&bitmap, subsetInfo, colors, colorCount); 75 alloc_pixels(&bitmap, subsetInfo, colors, colorCount);
76 76
77 scanlineDecoder->skipScanlines(fOffsetTop); 77 scanlineDecoder->skipScanlines(fOffsetTop);
78 uint32_t bpp = info.bytesPerPixel(); 78 uint32_t bpp = info.bytesPerPixel();
79 for (uint32_t y = 0; y < fSubsetHeight; y++) { 79 for (uint32_t y = 0; y < fSubsetHeight; y++) {
80 scanlineDecoder->getScanlines(row.get(), 1, 0); 80 scanlineDecoder->getScanlines(row.get(), 1, 0);
81 memcpy(bitmap.getAddr(0, y), row.get() + fOffsetLeft * bpp, 81 memcpy(bitmap.getAddr(0, y), row.get() + fOffsetLeft * bpp,
82 fSubsetWidth * bpp); 82 fSubsetWidth * bpp);
83 } 83 }
84 } 84 }
85 } else { 85 } else {
86 for (int count = 0; count < n; count++) { 86 for (int count = 0; count < n; count++) {
87 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStrea m)); 87 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStrea m));
88 int width, height; 88 int width, height;
89 decoder->buildTileIndex(fStream->duplicate(), &width, &height); 89 decoder->buildTileIndex(fStream->duplicate(), &width, &height);
90 SkBitmap bitmap; 90 SkBitmap bitmap;
91 SkIRect rect = SkIRect::MakeXYWH(fOffsetLeft, fOffsetTop, fSubsetWid th, 91 SkIRect rect = SkIRect::MakeXYWH(fOffsetLeft, fOffsetTop, fSubsetWid th,
92 fSubsetHeight); 92 fSubsetHeight);
93 decoder->decodeSubset(&bitmap, rect, fColorType); 93 decoder->decodeSubset(&bitmap, rect, fColorType);
94 } 94 }
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « bench/subset/SubsetBenchPriv.h ('k') | bench/subset/SubsetTranslateBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698