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

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

Issue 1344993003: Add nanobench tests for BitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SubsetSingleBench.cpp ('k') | bench/subset/SubsetZoomBench.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 "CodecBenchPriv.h"
8 #include "SubsetTranslateBench.h" 9 #include "SubsetTranslateBench.h"
9 #include "SubsetBenchPriv.h" 10 #include "SubsetBenchPriv.h"
10 #include "SkData.h" 11 #include "SkData.h"
11 #include "SkCodec.h" 12 #include "SkCodec.h"
12 #include "SkImageDecoder.h" 13 #include "SkImageDecoder.h"
13 #include "SkOSFile.h" 14 #include "SkOSFile.h"
14 #include "SkScanlineDecoder.h" 15 #include "SkScanlineDecoder.h"
15 #include "SkStream.h" 16 #include "SkStream.h"
16 17
17 /* 18 /*
(...skipping 10 matching lines...) Expand all
28 bool useCodec) 29 bool useCodec)
29 : fColorType(colorType) 30 : fColorType(colorType)
30 , fSubsetWidth(subsetWidth) 31 , fSubsetWidth(subsetWidth)
31 , fSubsetHeight(subsetHeight) 32 , fSubsetHeight(subsetHeight)
32 , fUseCodec(useCodec) 33 , fUseCodec(useCodec)
33 { 34 {
34 // Parse the filename 35 // Parse the filename
35 SkString baseName = SkOSPath::Basename(path.c_str()); 36 SkString baseName = SkOSPath::Basename(path.c_str());
36 37
37 // Choose an informative color name 38 // Choose an informative color name
38 const char* colorName = get_color_name(fColorType); 39 const char* colorName = color_type_to_str(fColorType);
39 40
40 fName.printf("%sSubsetTranslate_%dx%d_%s_%s", fUseCodec ? "Codec" : "Image", fSubsetWidth, 41 fName.printf("%sSubsetTranslate_%dx%d_%s_%s", fUseCodec ? "Codec" : "Image", fSubsetWidth,
41 fSubsetHeight, baseName.c_str(), colorName); 42 fSubsetHeight, baseName.c_str(), colorName);
42 43
43 // Perform the decode setup 44 // Perform the decode setup
44 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); 45 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
45 fStream.reset(new SkMemoryStream(encoded)); 46 fStream.reset(new SkMemoryStream(encoded));
46 } 47 }
47 48
48 const char* SubsetTranslateBench::onGetName() { 49 const char* SubsetTranslateBench::onGetName() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const uint32_t currSubsetHeight = y + (int) fSubsetHeight > height ? 118 const uint32_t currSubsetHeight = y + (int) fSubsetHeight > height ?
118 height - y : fSubsetHeight; 119 height - y : fSubsetHeight;
119 SkIRect rect = SkIRect::MakeXYWH(x, y, currSubsetWidth, 120 SkIRect rect = SkIRect::MakeXYWH(x, y, currSubsetWidth,
120 currSubsetHeight); 121 currSubsetHeight);
121 decoder->decodeSubset(&bitmap, rect, fColorType); 122 decoder->decodeSubset(&bitmap, rect, fColorType);
122 } 123 }
123 } 124 }
124 } 125 }
125 } 126 }
126 } 127 }
OLDNEW
« no previous file with comments | « bench/subset/SubsetSingleBench.cpp ('k') | bench/subset/SubsetZoomBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698