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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp e dstColorType, | 223 static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp e dstColorType, |
224 float scale) { | 224 float scale) { |
225 SkString folder; | 225 SkString folder; |
226 switch (mode) { | 226 switch (mode) { |
227 case CodecSrc::kCodec_Mode: | 227 case CodecSrc::kCodec_Mode: |
228 folder.append("codec"); | 228 folder.append("codec"); |
229 break; | 229 break; |
230 case CodecSrc::kScanline_Mode: | 230 case CodecSrc::kScanline_Mode: |
231 folder.append("scanline"); | 231 folder.append("scanline"); |
232 break; | 232 break; |
233 case CodecSrc::kScanline_Subset_Mode: | |
msarett
2015/11/16 23:20:58
I'm kind of on the fence about deleting this test.
scroggo
2015/11/17 14:56:26
It sounds like we have a bug that isn't being caug
msarett
2015/11/17 18:00:50
Well, the bug is that we don't decode subsets prop
scroggo
2015/11/17 18:18:25
Ah, of course. Yes, I think it makes sense to just
| |
234 folder.append("scanline_subset"); | |
235 break; | |
236 case CodecSrc::kStripe_Mode: | 233 case CodecSrc::kStripe_Mode: |
237 folder.append("stripe"); | 234 folder.append("stripe"); |
238 break; | 235 break; |
239 case CodecSrc::kSubset_Mode: | 236 case CodecSrc::kSubset_Mode: |
240 folder.append("codec_subset"); | 237 folder.append("codec_subset"); |
241 break; | 238 break; |
242 } | 239 } |
243 | 240 |
244 switch (dstColorType) { | 241 switch (dstColorType) { |
245 case CodecSrc::kGrayscale_Always_DstColorType: | 242 case CodecSrc::kGrayscale_Always_DstColorType: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 return; | 300 return; |
304 } | 301 } |
305 | 302 |
306 // Native Scales | 303 // Native Scales |
307 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co mpare with these | 304 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co mpare with these |
308 // tests. SkImageDecoder supports downscales by integer fac tors. | 305 // tests. SkImageDecoder supports downscales by integer fac tors. |
309 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875 | 306 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875 |
310 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f }; | 307 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f }; |
311 | 308 |
312 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca nline_Mode, | 309 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca nline_Mode, |
313 CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::k Subset_Mode }; | 310 CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode }; |
314 | 311 |
315 CodecSrc::DstColorType colorTypes[3]; | 312 CodecSrc::DstColorType colorTypes[3]; |
316 uint32_t numColorTypes; | 313 uint32_t numColorTypes; |
317 switch (codec->getInfo().colorType()) { | 314 switch (codec->getInfo().colorType()) { |
318 case kGray_8_SkColorType: | 315 case kGray_8_SkColorType: |
319 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? | 316 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? |
320 // Further discussion on this topic is at https://bug.skia.org/3683 . | 317 // Further discussion on this topic is at https://bug.skia.org/3683 . |
321 // This causes us to try to convert grayscale jpegs to kIndex8. We currently | 318 // This causes us to try to convert grayscale jpegs to kIndex8. We currently |
322 // fail non-fatally in this case. | 319 // fail non-fatally in this case. |
323 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 320 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 if (path.endsWith(ext)) { | 353 if (path.endsWith(ext)) { |
357 subset = true; | 354 subset = true; |
358 break; | 355 break; |
359 } | 356 } |
360 } | 357 } |
361 | 358 |
362 bool full = false; | 359 bool full = false; |
363 // The following image types are only supported by BitmapFactory, | 360 // The following image types are only supported by BitmapFactory, |
364 // so we only need to test full image decodes. | 361 // so we only need to test full image decodes. |
365 static const char* fullExts[] = { | 362 static const char* fullExts[] = { |
366 "wbmp", "bmp", | 363 "wbmp", "bmp", "gif", |
367 "WBMP", "BMP", | 364 "WBMP", "BMP", "GIF", |
368 }; | 365 }; |
369 for (const char* ext : fullExts) { | 366 for (const char* ext : fullExts) { |
370 if (path.endsWith(ext)) { | 367 if (path.endsWith(ext)) { |
371 full = true; | 368 full = true; |
372 break; | 369 break; |
373 } | 370 } |
374 } | 371 } |
375 | 372 |
376 if (!full && !subset) { | 373 if (!full && !subset) { |
377 return; | 374 return; |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 #endif // SK_PDF_IMAGE_STATS | 1143 #endif // SK_PDF_IMAGE_STATS |
1147 return 0; | 1144 return 0; |
1148 } | 1145 } |
1149 | 1146 |
1150 #if !defined(SK_BUILD_FOR_IOS) | 1147 #if !defined(SK_BUILD_FOR_IOS) |
1151 int main(int argc, char** argv) { | 1148 int main(int argc, char** argv) { |
1152 SkCommandLineFlags::Parse(argc, argv); | 1149 SkCommandLineFlags::Parse(argc, argv); |
1153 return dm_main(); | 1150 return dm_main(); |
1154 } | 1151 } |
1155 #endif | 1152 #endif |
OLD | NEW |