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

Side by Side Diff: bench/BitmapRegionDecoderBench.cpp

Issue 1443033002: Remove dependency on src/android from dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | dm/DM.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 "BitmapRegionDecoderBench.h" 8 #include "BitmapRegionDecoderBench.h"
9 #include "CodecBenchPriv.h" 9 #include "CodecBenchPriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkBitmapRegionDecoderPriv.h"
12 #include "SkOSFile.h" 11 #include "SkOSFile.h"
13 12
14 BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded, 13 BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded,
15 SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType, 14 SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType,
16 uint32_t sampleSize, const SkIRect& subset) 15 uint32_t sampleSize, const SkIRect& subset)
17 : fBRD(nullptr) 16 : fBRD(nullptr)
18 , fData(SkRef(encoded)) 17 , fData(SkRef(encoded))
19 , fStrategy(strategy) 18 , fStrategy(strategy)
20 , fColorType(colorType) 19 , fColorType(colorType)
21 , fSampleSize(sampleSize) 20 , fSampleSize(sampleSize)
(...skipping 12 matching lines...) Expand all
34 SkASSERT(false); 33 SkASSERT(false);
35 strategyName = ""; 34 strategyName = "";
36 break; 35 break;
37 } 36 }
38 37
39 // Choose a useful name for the color type 38 // Choose a useful name for the color type
40 const char* colorName = color_type_to_str(colorType); 39 const char* colorName = color_type_to_str(colorType);
41 40
42 fName.printf("BRD_%s_%s_%s", baseName, strategyName, colorName); 41 fName.printf("BRD_%s_%s_%s", baseName, strategyName, colorName);
43 if (1 != sampleSize) { 42 if (1 != sampleSize) {
44 fName.appendf("_%.3f", get_scale_from_sample_size(sampleSize)); 43 fName.appendf("_%.3f", 1.0f / (float) sampleSize);
mtklein 2015/11/13 17:37:09 all these (float) are implicit, but lgtm if it mak
msarett 2015/11/13 17:47:07 It does make me feel better to remind myself that
45 } 44 }
46 } 45 }
47 46
48 const char* BitmapRegionDecoderBench::onGetName() { 47 const char* BitmapRegionDecoderBench::onGetName() {
49 return fName.c_str(); 48 return fName.c_str();
50 } 49 }
51 50
52 bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) { 51 bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) {
53 return kNonRendering_Backend == backend; 52 return kNonRendering_Backend == backend;
54 } 53 }
55 54
56 void BitmapRegionDecoderBench::onDelayedSetup() { 55 void BitmapRegionDecoderBench::onDelayedSetup() {
57 fBRD.reset(SkBitmapRegionDecoder::Create(fData, fStrategy)); 56 fBRD.reset(SkBitmapRegionDecoder::Create(fData, fStrategy));
58 } 57 }
59 58
60 void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) { 59 void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) {
61 for (int i = 0; i < n; i++) { 60 for (int i = 0; i < n; i++) {
62 SkBitmap bm; 61 SkBitmap bm;
63 SkAssertResult(fBRD->decodeRegion(&bm, nullptr, fSubset, fSampleSize, fC olorType, false)); 62 SkAssertResult(fBRD->decodeRegion(&bm, nullptr, fSubset, fSampleSize, fC olorType, false));
64 } 63 }
65 } 64 }
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698