Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
| 9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
| 10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 if (!encoded) { | 196 if (!encoded) { |
| 197 SkDebugf("Couldn't read %s.", path.c_str()); | 197 SkDebugf("Couldn't read %s.", path.c_str()); |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 200 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
| 201 if (NULL == codec.get()) { | 201 if (NULL == codec.get()) { |
| 202 SkDebugf("Couldn't create codec for %s.", path.c_str()); | 202 SkDebugf("Couldn't create codec for %s.", path.c_str()); |
| 203 return; | 203 return; |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Choose scales for scaling tests | |
| 207 const float scales[] = { 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }; | |
|
scroggo
2015/06/11 15:50:02
It looks we'll use 1.0f twice - once in kScale_Mod
msarett
2015/06/11 19:29:35
In the new design, scale is not a mode. Rather, e
| |
| 208 | |
| 206 // Build additional test cases for images that decode natively to non-canvas types | 209 // Build additional test cases for images that decode natively to non-canvas types |
| 207 switch(codec->getInfo().colorType()) { | 210 switch(codec->getInfo().colorType()) { |
| 208 case kGray_8_SkColorType: | 211 case kGray_8_SkColorType: |
| 209 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, | 212 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, |
| 210 CodecSrc::kGrayscale_Always_DstColorType)); | 213 CodecSrc::kGrayscale_Always_DstColorType, 1.0f)); |
| 211 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, | 214 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, |
| 212 CodecSrc::kGrayscale_Always_DstColorType)); | 215 CodecSrc::kGrayscale_Always_DstColorType, 1.0f)); |
| 213 push_src("image", "scanline_subset_kGray8", new CodecSrc(path, | 216 push_src("image", "scanline_subset_kGray8", new CodecSrc(path, |
| 214 CodecSrc::kScanline_Subset_Mode, CodecSrc::kGrayscale_Always _DstColorType)); | 217 CodecSrc::kScanline_Subset_Mode, CodecSrc::kGrayscale_Always _DstColorType, |
| 218 1.0f)); | |
| 219 for (float scale : scales) { | |
| 220 push_src("image", "scale_kGray8", new CodecSrc(path, CodecSrc::k Scale_Mode, | |
| 221 CodecSrc::kGrayscale_Always_DstColorType, scale)); | |
| 222 } | |
| 215 // Intentional fall through | 223 // Intentional fall through |
| 216 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? | 224 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? |
| 217 // Further discussion on this topic is at skbug.com/3683 | 225 // Further discussion on this topic is at skbug.com/3683 |
| 218 case kIndex_8_SkColorType: | 226 case kIndex_8_SkColorType: |
| 219 push_src("image", "codec_kIndex8", new CodecSrc(path, CodecSrc::kNor mal_Mode, | 227 push_src("image", "codec_kIndex8", new CodecSrc(path, CodecSrc::kNor mal_Mode, |
| 220 CodecSrc::kIndex8_Always_DstColorType)); | 228 CodecSrc::kIndex8_Always_DstColorType, 1.0f)); |
| 221 push_src("image", "scanline_kIndex8", new CodecSrc(path, CodecSrc::k Scanline_Mode, | 229 push_src("image", "scanline_kIndex8", new CodecSrc(path, CodecSrc::k Scanline_Mode, |
| 222 CodecSrc::kIndex8_Always_DstColorType)); | 230 CodecSrc::kIndex8_Always_DstColorType, 1.0f)); |
| 223 push_src("image", "scanline_subset_kIndex8", new CodecSrc(path, | 231 push_src("image", "scanline_subset_kIndex8", new CodecSrc(path, |
| 224 CodecSrc::kScanline_Subset_Mode, CodecSrc::kIndex8_Always_Ds tColorType)); | 232 CodecSrc::kScanline_Subset_Mode, CodecSrc::kIndex8_Always_Ds tColorType, 1.0f)); |
| 233 for (float scale : scales) { | |
| 234 push_src("image", "scale_kIndex8", new CodecSrc(path, CodecSrc:: kScale_Mode, | |
| 235 CodecSrc::kIndex8_Always_DstColorType, scale)); | |
| 236 } | |
| 225 break; | 237 break; |
| 226 default: | 238 default: |
| 227 // Do nothing | 239 // Do nothing |
| 228 break; | 240 break; |
| 229 } | 241 } |
| 230 | 242 |
| 231 // Decode all images to the canvas color type | 243 // Decode all images to the canvas color type |
| 232 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, | 244 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, |
| 233 CodecSrc::kGetFromCanvas_DstColorType)); | 245 CodecSrc::kGetFromCanvas_DstColorType, 1.0f)); |
| 234 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, | 246 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, |
|
scroggo
2015/06/11 15:50:02
I could imagine that it might be useful to test sc
msarett
2015/06/11 19:29:35
I agree. The new patch tests scaling for all of t
| |
| 235 CodecSrc::kGetFromCanvas_DstColorType)); | 247 CodecSrc::kGetFromCanvas_DstColorType, 1.0f)); |
| 236 push_src("image", "scanline_subset", new CodecSrc(path, CodecSrc::kScanline_ Subset_Mode, | 248 push_src("image", "scanline_subset", new CodecSrc(path, CodecSrc::kScanline_ Subset_Mode, |
| 237 CodecSrc::kGetFromCanvas_DstColorType)); | 249 CodecSrc::kGetFromCanvas_DstColorType, 1.0f)); |
| 250 for (float scale : scales) { | |
| 251 push_src("image", "scale", new CodecSrc(path, CodecSrc::kScale_Mode, | |
| 252 CodecSrc::kGetFromCanvas_DstColorType, scale)); | |
| 253 } | |
| 238 } | 254 } |
| 239 | 255 |
| 240 static bool codec_supported(const char* ext) { | 256 static bool codec_supported(const char* ext) { |
| 241 // FIXME: Once other versions of SkCodec are available, we can add them to t his | 257 // FIXME: Once other versions of SkCodec are available, we can add them to t his |
| 242 // list (and eventually we can remove this check once they are all supported ). | 258 // list (and eventually we can remove this check once they are all supported ). |
| 243 static const char* const exts[] = { | 259 static const char* const exts[] = { |
| 244 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", | 260 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", |
| 245 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" | 261 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" |
| 246 }; | 262 }; |
| 247 | 263 |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 } | 789 } |
| 774 return 0; | 790 return 0; |
| 775 } | 791 } |
| 776 | 792 |
| 777 #if !defined(SK_BUILD_FOR_IOS) | 793 #if !defined(SK_BUILD_FOR_IOS) |
| 778 int main(int argc, char** argv) { | 794 int main(int argc, char** argv) { |
| 779 SkCommandLineFlags::Parse(argc, argv); | 795 SkCommandLineFlags::Parse(argc, argv); |
| 780 return dm_main(); | 796 return dm_main(); |
| 781 } | 797 } |
| 782 #endif | 798 #endif |
| OLD | NEW |