| 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 "SubsetZoomBench.h" | 9 #include "SubsetZoomBench.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 Loading... |
| 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("%sSubsetZoom_%dx%d_%s_%s", fUseCodec ? "Codec" : "Image", fSub
setWidth, | 41 fName.printf("%sSubsetZoom_%dx%d_%s_%s", fUseCodec ? "Codec" : "Image", fSub
setWidth, |
| 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* SubsetZoomBench::onGetName() { | 49 const char* SubsetZoomBench::onGetName() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 SkBitmap bitmap; | 111 SkBitmap bitmap; |
| 111 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub
setWidth, | 112 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub
setWidth, |
| 112 subsetHeight); | 113 subsetHeight); |
| 113 decoder->decodeSubset(&bitmap, rect, fColorType); | 114 decoder->decodeSubset(&bitmap, rect, fColorType); |
| 114 w <<= 1; | 115 w <<= 1; |
| 115 h <<= 1; | 116 h <<= 1; |
| 116 } while (w < 2 * width || h < 2 * height); | 117 } while (w < 2 * width || h < 2 * height); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 } | 120 } |
| OLD | NEW |