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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // https://bug.skia.org/4428 | 347 // https://bug.skia.org/4428 |
348 static const char* const exts[] = { | 348 bool subset = false; |
| 349 // The following image types are supported by BitmapRegionDecoder, |
| 350 // so we will test full image decodes and subset decodes. |
| 351 static const char* const subsetExts[] = { |
349 "jpg", "jpeg", "png", "webp", | 352 "jpg", "jpeg", "png", "webp", |
350 "JPG", "JPEG", "PNG", "WEBP", | 353 "JPG", "JPEG", "PNG", "WEBP", |
351 }; | 354 }; |
352 bool supported = false; | 355 for (const char* ext : subsetExts) { |
353 for (const char* ext : exts) { | |
354 if (path.endsWith(ext)) { | 356 if (path.endsWith(ext)) { |
355 supported = true; | 357 subset = true; |
356 break; | 358 break; |
357 } | 359 } |
358 } | 360 } |
359 if (!supported) { | 361 |
| 362 bool full = false; |
| 363 // The following image types are only supported by BitmapFactory, |
| 364 // so we only need to test full image decodes. |
| 365 static const char* fullExts[] = { |
| 366 "wbmp", |
| 367 "WBMP", |
| 368 }; |
| 369 for (const char* ext : fullExts) { |
| 370 if (path.endsWith(ext)) { |
| 371 full = true; |
| 372 break; |
| 373 } |
| 374 } |
| 375 |
| 376 if (!full && !subset) { |
360 return; | 377 return; |
361 } | 378 } |
362 | 379 |
363 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 380 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
364 | 381 |
365 const AndroidCodecSrc::Mode androidModes[] = { | |
366 AndroidCodecSrc::kFullImage_Mode, | |
367 AndroidCodecSrc::kDivisor_Mode, | |
368 }; | |
369 | |
370 for (int sampleSize : sampleSizes) { | 382 for (int sampleSize : sampleSizes) { |
371 for (AndroidCodecSrc::Mode mode : androidModes) { | 383 for (uint32_t i = 0; i < numColorTypes; i++) { |
372 for (uint32_t i = 0; i < numColorTypes; i++) { | 384 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, color
Types[i], |
373 push_android_codec_src(path, mode, colorTypes[i], sampleSize); | 385 sampleSize); |
| 386 if (subset) { |
| 387 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode, col
orTypes[i], |
| 388 sampleSize); |
374 } | 389 } |
375 } | 390 } |
376 } | 391 } |
377 } | 392 } |
378 | 393 |
379 static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy, | 394 static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy, |
380 CodecSrc::DstColorType dstColorType) { | 395 CodecSrc::DstColorType dstColorType) { |
381 switch (strategy) { | 396 switch (strategy) { |
382 case SkBitmapRegionDecoder::kCanvas_Strategy: | 397 case SkBitmapRegionDecoder::kCanvas_Strategy: |
383 if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) { | 398 if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) { |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 #endif // SK_PDF_IMAGE_STATS | 1146 #endif // SK_PDF_IMAGE_STATS |
1132 return 0; | 1147 return 0; |
1133 } | 1148 } |
1134 | 1149 |
1135 #if !defined(SK_BUILD_FOR_IOS) | 1150 #if !defined(SK_BUILD_FOR_IOS) |
1136 int main(int argc, char** argv) { | 1151 int main(int argc, char** argv) { |
1137 SkCommandLineFlags::Parse(argc, argv); | 1152 SkCommandLineFlags::Parse(argc, argv); |
1138 return dm_main(); | 1153 return dm_main(); |
1139 } | 1154 } |
1140 #endif | 1155 #endif |
OLD | NEW |