| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 307 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
| 308 if (nullptr == codec.get()) { | 308 if (nullptr == codec.get()) { |
| 309 SkDebugf("Couldn't create codec for %s.", path.c_str()); | 309 SkDebugf("Couldn't create codec for %s.", path.c_str()); |
| 310 return; | 310 return; |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Native Scales | 313 // Native Scales |
| 314 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these | 314 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these |
| 315 // tests. SkImageDecoder supports downscales by integer fac
tors. | 315 // tests. SkImageDecoder supports downscales by integer fac
tors. |
| 316 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 | 316 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 |
| 317 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; | 317 const float nativeScales[] = { /*0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f
, 0.875f,*/ 1.0f }; |
| 318 | 318 |
| 319 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kCod
ecZeroInit_Mode, | 319 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, /*CodecSrc::kC
odecZeroInit_Mode, |
| 320 CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_
Mode, | 320 CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_
Mode, |
| 321 CodecSrc::kGen_Mode }; | 321 CodecSrc::kGen_Mode*/ }; |
| 322 | 322 |
| 323 CodecSrc::DstColorType colorTypes[3]; | 323 CodecSrc::DstColorType colorTypes[3]; |
| 324 uint32_t numColorTypes; | 324 uint32_t numColorTypes; |
| 325 switch (codec->getInfo().colorType()) { | 325 switch (codec->getInfo().colorType()) { |
| 326 case kGray_8_SkColorType: | 326 case kGray_8_SkColorType: |
| 327 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? | 327 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? |
| 328 // Further discussion on this topic is at https://bug.skia.org/3683
. | 328 // Further discussion on this topic is at https://bug.skia.org/3683
. |
| 329 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently | 329 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently |
| 330 // fail non-fatally in this case. | 330 // fail non-fatally in this case. |
| 331 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 331 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 "jpg", "jpeg", "png", "webp", | 373 "jpg", "jpeg", "png", "webp", |
| 374 "JPG", "JPEG", "PNG", "WEBP", | 374 "JPG", "JPEG", "PNG", "WEBP", |
| 375 }; | 375 }; |
| 376 for (const char* ext : exts) { | 376 for (const char* ext : exts) { |
| 377 if (path.endsWith(ext)) { | 377 if (path.endsWith(ext)) { |
| 378 subset = true; | 378 subset = true; |
| 379 break; | 379 break; |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 383 const int sampleSizes[] = { /*1, 2, 3, 4, 5, 6, 7, 8*/ }; |
| 384 | 384 |
| 385 for (int sampleSize : sampleSizes) { | 385 for (int sampleSize : sampleSizes) { |
| 386 for (uint32_t i = 0; i < numColorTypes; i++) { | 386 for (uint32_t i = 0; i < numColorTypes; i++) { |
| 387 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, color
Types[i], | 387 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, color
Types[i], |
| 388 sampleSize); | 388 sampleSize); |
| 389 if (subset) { | 389 if (subset) { |
| 390 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode, col
orTypes[i], | 390 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode, col
orTypes[i], |
| 391 sampleSize); | 391 sampleSize); |
| 392 } | 392 } |
| 393 } | 393 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 const SkBitmapRegionDecoder::Strategy strategies[] = { | 470 const SkBitmapRegionDecoder::Strategy strategies[] = { |
| 471 SkBitmapRegionDecoder::kCanvas_Strategy, | 471 SkBitmapRegionDecoder::kCanvas_Strategy, |
| 472 SkBitmapRegionDecoder::kAndroidCodec_Strategy, | 472 SkBitmapRegionDecoder::kAndroidCodec_Strategy, |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 // Test on a variety of sampleSizes, making sure to include: | 475 // Test on a variety of sampleSizes, making sure to include: |
| 476 // - 2, 4, and 8, which are natively supported by jpeg | 476 // - 2, 4, and 8, which are natively supported by jpeg |
| 477 // - multiples of 2 which are not divisible by 4 (analogous for 4) | 477 // - multiples of 2 which are not divisible by 4 (analogous for 4) |
| 478 // - larger powers of two, since BRD clients generally use powers of 2 | 478 // - larger powers of two, since BRD clients generally use powers of 2 |
| 479 // We will only produce output for the larger sizes on large images. | 479 // We will only produce output for the larger sizes on large images. |
| 480 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64
}; | 480 const uint32_t sampleSizes[] = { /*1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 6
4*/ }; |
| 481 | 481 |
| 482 // We will only test to one backend (8888), but we will test all of the | 482 // We will only test to one backend (8888), but we will test all of the |
| 483 // color types that we need to decode to on this backend. | 483 // color types that we need to decode to on this backend. |
| 484 const CodecSrc::DstColorType dstColorTypes[] = { | 484 const CodecSrc::DstColorType dstColorTypes[] = { |
| 485 CodecSrc::kGetFromCanvas_DstColorType, | 485 CodecSrc::kGetFromCanvas_DstColorType, |
| 486 CodecSrc::kIndex8_Always_DstColorType, | 486 CodecSrc::kIndex8_Always_DstColorType, |
| 487 CodecSrc::kGrayscale_Always_DstColorType, | 487 CodecSrc::kGrayscale_Always_DstColorType, |
| 488 }; | 488 }; |
| 489 | 489 |
| 490 const BRDSrc::Mode modes[] = { | 490 const BRDSrc::Mode modes[] = { |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 Reporter* reporter, | 1261 Reporter* reporter, |
| 1262 GrContextFactory* fac
tory); | 1262 GrContextFactory* fac
tory); |
| 1263 } // namespace skiatest | 1263 } // namespace skiatest |
| 1264 | 1264 |
| 1265 #if !defined(SK_BUILD_FOR_IOS) | 1265 #if !defined(SK_BUILD_FOR_IOS) |
| 1266 int main(int argc, char** argv) { | 1266 int main(int argc, char** argv) { |
| 1267 SkCommandLineFlags::Parse(argc, argv); | 1267 SkCommandLineFlags::Parse(argc, argv); |
| 1268 return dm_main(); | 1268 return dm_main(); |
| 1269 } | 1269 } |
| 1270 #endif | 1270 #endif |
| OLD | NEW |