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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 } | 337 } |
338 | 338 |
339 for (float scale : nativeScales) { | 339 for (float scale : nativeScales) { |
340 for (CodecSrc::Mode mode : nativeModes) { | 340 for (CodecSrc::Mode mode : nativeModes) { |
341 for (uint32_t i = 0; i < numColorTypes; i++) { | 341 for (uint32_t i = 0; i < numColorTypes; i++) { |
342 push_codec_src(path, mode, colorTypes[i], scale); | 342 push_codec_src(path, mode, colorTypes[i], scale); |
343 } | 343 } |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 uint32_t numAndroidModes = 0; | |
347 // https://bug.skia.org/4428 | 348 // https://bug.skia.org/4428 |
349 // Only test subsets for these selected image types. | |
scroggo
2015/11/16 15:19:58
nit: This sentence is ambiguous - I read it as mea
| |
348 static const char* const exts[] = { | 350 static const char* const exts[] = { |
349 "jpg", "jpeg", "png", "webp", | 351 "jpg", "jpeg", "png", "webp", |
350 "JPG", "JPEG", "PNG", "WEBP", | 352 "JPG", "JPEG", "PNG", "WEBP", |
351 }; | 353 }; |
352 bool supported = false; | |
353 for (const char* ext : exts) { | 354 for (const char* ext : exts) { |
354 if (path.endsWith(ext)) { | 355 if (path.endsWith(ext)) { |
355 supported = true; | 356 numAndroidModes = 2; |
356 break; | 357 break; |
357 } | 358 } |
358 } | 359 } |
359 if (!supported) { | 360 |
360 return; | 361 static const char* onlyFullImageExts[] = { |
362 "wbmp", | |
363 "WBMP", | |
364 }; | |
365 for (const char* ext : onlyFullImageExts) { | |
366 if (path.endsWith(ext)) { | |
367 numAndroidModes = 1; | |
368 break; | |
369 } | |
361 } | 370 } |
362 | 371 |
363 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 372 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
364 | 373 |
365 const AndroidCodecSrc::Mode androidModes[] = { | 374 const AndroidCodecSrc::Mode androidModes[] = { |
366 AndroidCodecSrc::kFullImage_Mode, | 375 AndroidCodecSrc::kFullImage_Mode, |
367 AndroidCodecSrc::kDivisor_Mode, | 376 AndroidCodecSrc::kDivisor_Mode, |
368 }; | 377 }; |
369 | 378 |
370 for (int sampleSize : sampleSizes) { | 379 for (int sampleSize : sampleSizes) { |
371 for (AndroidCodecSrc::Mode mode : androidModes) { | 380 for (uint32_t m = 0; m < numAndroidModes; m++) { |
scroggo
2015/11/16 15:19:58
Now I think I see why you were tempted to go all t
msarett
2015/11/16 15:40:57
I think you could make a good argument for this.
| |
372 for (uint32_t i = 0; i < numColorTypes; i++) { | 381 for (uint32_t i = 0; i < numColorTypes; i++) { |
373 push_android_codec_src(path, mode, colorTypes[i], sampleSize); | 382 push_android_codec_src(path, androidModes[m], colorTypes[i], sam pleSize); |
374 } | 383 } |
375 } | 384 } |
376 } | 385 } |
377 } | 386 } |
378 | 387 |
379 static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy, | 388 static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy, |
380 CodecSrc::DstColorType dstColorType) { | 389 CodecSrc::DstColorType dstColorType) { |
381 switch (strategy) { | 390 switch (strategy) { |
382 case SkBitmapRegionDecoder::kCanvas_Strategy: | 391 case SkBitmapRegionDecoder::kCanvas_Strategy: |
383 if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) { | 392 if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) { |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1131 #endif // SK_PDF_IMAGE_STATS | 1140 #endif // SK_PDF_IMAGE_STATS |
1132 return 0; | 1141 return 0; |
1133 } | 1142 } |
1134 | 1143 |
1135 #if !defined(SK_BUILD_FOR_IOS) | 1144 #if !defined(SK_BUILD_FOR_IOS) |
1136 int main(int argc, char** argv) { | 1145 int main(int argc, char** argv) { |
1137 SkCommandLineFlags::Parse(argc, argv); | 1146 SkCommandLineFlags::Parse(argc, argv); |
1138 return dm_main(); | 1147 return dm_main(); |
1139 } | 1148 } |
1140 #endif | 1149 #endif |
OLD | NEW |