OLD | NEW |
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 "SubsetSingleBench.h" | 9 #include "SubsetSingleBench.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 14 matching lines...) Expand all Loading... |
32 , fSubsetWidth(subsetWidth) | 33 , fSubsetWidth(subsetWidth) |
33 , fSubsetHeight(subsetHeight) | 34 , fSubsetHeight(subsetHeight) |
34 , fOffsetLeft(offsetLeft) | 35 , fOffsetLeft(offsetLeft) |
35 , fOffsetTop(offsetTop) | 36 , fOffsetTop(offsetTop) |
36 , fUseCodec(useCodec) | 37 , fUseCodec(useCodec) |
37 { | 38 { |
38 // Parse the filename | 39 // Parse the filename |
39 SkString baseName = SkOSPath::Basename(path.c_str()); | 40 SkString baseName = SkOSPath::Basename(path.c_str()); |
40 | 41 |
41 // Choose an informative color name | 42 // Choose an informative color name |
42 const char* colorName = get_color_name(fColorType); | 43 const char* colorName = color_type_to_str(fColorType); |
43 | 44 |
44 fName.printf("%sSubsetSingle_%dx%d +%d_+%d_%s_%s", fUseCodec ? "Codec" : "Im
age", fSubsetWidth, | 45 fName.printf("%sSubsetSingle_%dx%d +%d_+%d_%s_%s", fUseCodec ? "Codec" : "Im
age", fSubsetWidth, |
45 fSubsetHeight, fOffsetLeft, fOffsetTop, baseName.c_str(), colorName)
; | 46 fSubsetHeight, fOffsetLeft, fOffsetTop, baseName.c_str(), colorName)
; |
46 | 47 |
47 // Perform the decode setup | 48 // Perform the decode setup |
48 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); | 49 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); |
49 fStream.reset(new SkMemoryStream(encoded)); | 50 fStream.reset(new SkMemoryStream(encoded)); |
50 } | 51 } |
51 | 52 |
52 const char* SubsetSingleBench::onGetName() { | 53 const char* SubsetSingleBench::onGetName() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStrea
m)); | 88 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStrea
m)); |
88 int width, height; | 89 int width, height; |
89 decoder->buildTileIndex(fStream->duplicate(), &width, &height); | 90 decoder->buildTileIndex(fStream->duplicate(), &width, &height); |
90 SkBitmap bitmap; | 91 SkBitmap bitmap; |
91 SkIRect rect = SkIRect::MakeXYWH(fOffsetLeft, fOffsetTop, fSubsetWid
th, | 92 SkIRect rect = SkIRect::MakeXYWH(fOffsetLeft, fOffsetTop, fSubsetWid
th, |
92 fSubsetHeight); | 93 fSubsetHeight); |
93 decoder->decodeSubset(&bitmap, rect, fColorType); | 94 decoder->decodeSubset(&bitmap, rect, fColorType); |
94 } | 95 } |
95 } | 96 } |
96 } | 97 } |
OLD | NEW |