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

Side by Side Diff: bench/CodecBench.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 | « no previous file | bench/nanobench.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 "CodecBench.h" 8 #include "CodecBench.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
11 #include "SkImageGenerator.h"
12 #include "SkOSFile.h" 11 #include "SkOSFile.h"
13 12
14 CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType ) 13 CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType )
15 : fColorType(colorType) 14 : fColorType(colorType)
16 , fData(SkRef(encoded)) 15 , fData(SkRef(encoded))
17 { 16 {
18 // Parse filename and the color type to give the benchmark a useful name 17 // Parse filename and the color type to give the benchmark a useful name
19 const char* colorName; 18 const char* colorName;
20 switch(colorType) { 19 switch(colorType) {
21 case kN32_SkColorType: 20 case kN32_SkColorType:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 62 }
64 63
65 void CodecBench::onDraw(const int n, SkCanvas* canvas) { 64 void CodecBench::onDraw(const int n, SkCanvas* canvas) {
66 SkAutoTDelete<SkCodec> codec; 65 SkAutoTDelete<SkCodec> codec;
67 SkPMColor colorTable[256]; 66 SkPMColor colorTable[256];
68 int colorCount; 67 int colorCount;
69 for (int i = 0; i < n; i++) { 68 for (int i = 0; i < n; i++) {
70 colorCount = 256; 69 colorCount = 256;
71 codec.reset(SkCodec::NewFromData(fData)); 70 codec.reset(SkCodec::NewFromData(fData));
72 #ifdef SK_DEBUG 71 #ifdef SK_DEBUG
73 const SkImageGenerator::Result result = 72 const SkCodec::Result result =
74 #endif 73 #endif
75 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), 74 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(),
76 NULL, colorTable, &colorCount); 75 NULL, colorTable, &colorCount);
77 SkASSERT(result == SkImageGenerator::kSuccess 76 SkASSERT(result == SkCodec::kSuccess
78 || result == SkImageGenerator::kIncompleteInput); 77 || result == SkCodec::kIncompleteInput);
79 } 78 }
80 } 79 }
OLDNEW
« no previous file with comments | « no previous file | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698