| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 301 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
| 302 if (nullptr == codec.get()) { | 302 if (nullptr == codec.get()) { |
| 303 SkDebugf("Couldn't create codec for %s.", path.c_str()); | 303 SkDebugf("Couldn't create codec for %s.", path.c_str()); |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 | 306 |
| 307 // Native Scales | 307 // Native Scales |
| 308 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these | 308 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these |
| 309 // tests. SkImageDecoder supports downscales by integer fac
tors. | 309 // tests. SkImageDecoder supports downscales by integer fac
tors. |
| 310 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 | 310 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 |
| 311 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; | 311 const float nativeScales[] = { /*0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f
, 0.875f,*/ 1.0f }; |
| 312 | 312 |
| 313 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca
nline_Mode, | 313 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, //CodecSrc::kS
canline_Mode, |
| 314 CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode }; | 314 CodecSrc::kStripe_Mode, /*CodecSrc::kSubset_Mode*/ }; |
| 315 | 315 |
| 316 CodecSrc::DstColorType colorTypes[3]; | 316 CodecSrc::DstColorType colorTypes[3]; |
| 317 uint32_t numColorTypes; | 317 uint32_t numColorTypes; |
| 318 switch (codec->getInfo().colorType()) { | 318 switch (codec->getInfo().colorType()) { |
| 319 case kGray_8_SkColorType: | 319 case kGray_8_SkColorType: |
| 320 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? | 320 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? |
| 321 // Further discussion on this topic is at https://bug.skia.org/3683
. | 321 // Further discussion on this topic is at https://bug.skia.org/3683
. |
| 322 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently | 322 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently |
| 323 // fail non-fatally in this case. | 323 // fail non-fatally in this case. |
| 324 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 324 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 353 "jpg", "jpeg", "png", "webp", | 353 "jpg", "jpeg", "png", "webp", |
| 354 "JPG", "JPEG", "PNG", "WEBP", | 354 "JPG", "JPEG", "PNG", "WEBP", |
| 355 }; | 355 }; |
| 356 for (const char* ext : exts) { | 356 for (const char* ext : exts) { |
| 357 if (path.endsWith(ext)) { | 357 if (path.endsWith(ext)) { |
| 358 subset = true; | 358 subset = true; |
| 359 break; | 359 break; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 363 const int sampleSizes[] = { /*1, 2, 3, 4, 5, 6, 7, 8*/ }; |
| 364 | 364 |
| 365 for (int sampleSize : sampleSizes) { | 365 for (int sampleSize : sampleSizes) { |
| 366 for (uint32_t i = 0; i < numColorTypes; i++) { | 366 for (uint32_t i = 0; i < numColorTypes; i++) { |
| 367 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, color
Types[i], | 367 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, color
Types[i], |
| 368 sampleSize); | 368 sampleSize); |
| 369 if (subset) { | 369 if (subset) { |
| 370 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode, col
orTypes[i], | 370 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode, col
orTypes[i], |
| 371 sampleSize); | 371 sampleSize); |
| 372 } | 372 } |
| 373 } | 373 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 folder.appendf("_%.3f", 1.0f / (float) sampleSize); | 441 folder.appendf("_%.3f", 1.0f / (float) sampleSize); |
| 442 } | 442 } |
| 443 | 443 |
| 444 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); | 444 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); |
| 445 push_src("image", folder, src); | 445 push_src("image", folder, src); |
| 446 } | 446 } |
| 447 | 447 |
| 448 static void push_brd_srcs(Path path) { | 448 static void push_brd_srcs(Path path) { |
| 449 | 449 |
| 450 const SkBitmapRegionDecoder::Strategy strategies[] = { | 450 const SkBitmapRegionDecoder::Strategy strategies[] = { |
| 451 SkBitmapRegionDecoder::kCanvas_Strategy, | 451 //SkBitmapRegionDecoder::kCanvas_Strategy, |
| 452 SkBitmapRegionDecoder::kAndroidCodec_Strategy, | 452 //SkBitmapRegionDecoder::kAndroidCodec_Strategy, |
| 453 }; | 453 }; |
| 454 | 454 |
| 455 // Test on a variety of sampleSizes, making sure to include: | 455 // Test on a variety of sampleSizes, making sure to include: |
| 456 // - 2, 4, and 8, which are natively supported by jpeg | 456 // - 2, 4, and 8, which are natively supported by jpeg |
| 457 // - multiples of 2 which are not divisible by 4 (analogous for 4) | 457 // - multiples of 2 which are not divisible by 4 (analogous for 4) |
| 458 // - larger powers of two, since BRD clients generally use powers of 2 | 458 // - larger powers of two, since BRD clients generally use powers of 2 |
| 459 // We will only produce output for the larger sizes on large images. | 459 // We will only produce output for the larger sizes on large images. |
| 460 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64
}; | 460 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64
}; |
| 461 | 461 |
| 462 // We will only test to one backend (8888), but we will test all of the | 462 // We will only test to one backend (8888), but we will test all of the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, | 518 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, |
| 519 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, | 519 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, |
| 520 }; | 520 }; |
| 521 for (int i = 0; i < FLAGS_images.count(); i++) { | 521 for (int i = 0; i < FLAGS_images.count(); i++) { |
| 522 const char* flag = FLAGS_images[i]; | 522 const char* flag = FLAGS_images[i]; |
| 523 if (sk_isdir(flag)) { | 523 if (sk_isdir(flag)) { |
| 524 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 524 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
| 525 SkOSFile::Iter it(flag, exts[j]); | 525 SkOSFile::Iter it(flag, exts[j]); |
| 526 for (SkString file; it.next(&file); ) { | 526 for (SkString file; it.next(&file); ) { |
| 527 SkString path = SkOSPath::Join(flag, file.c_str()); | 527 SkString path = SkOSPath::Join(flag, file.c_str()); |
| 528 push_src("image", "decode", new ImageSrc(path)); // Decode e
ntire image | 528 //push_src("image", "decode", new ImageSrc(path)); // Decode
entire image |
| 529 push_codec_srcs(path); | 529 push_codec_srcs(path); |
| 530 if (brd_supported(exts[j])) { | 530 if (brd_supported(exts[j])) { |
| 531 push_brd_srcs(path); | 531 push_brd_srcs(path); |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 } | 534 } |
| 535 } else if (sk_exists(flag)) { | 535 } else if (sk_exists(flag)) { |
| 536 // assume that FLAGS_images[i] is a valid image if it is a file. | 536 // assume that FLAGS_images[i] is a valid image if it is a file. |
| 537 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im
age. | 537 //push_src("image", "decode", new ImageSrc(flag)); // Decode entire
image. |
| 538 push_codec_srcs(flag); | 538 push_codec_srcs(flag); |
| 539 push_brd_srcs(flag); | 539 //push_brd_srcs(flag); |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 #if SK_SUPPORT_GPU | 544 #if SK_SUPPORT_GPU |
| 545 static GrGLStandard get_gpu_api() { | 545 static GrGLStandard get_gpu_api() { |
| 546 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } | 546 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } |
| 547 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } | 547 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } |
| 548 return kNone_GrGLStandard; | 548 return kNone_GrGLStandard; |
| 549 } | 549 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 Reporter* reporter, | 1218 Reporter* reporter, |
| 1219 GrContextFactory* fac
tory); | 1219 GrContextFactory* fac
tory); |
| 1220 } // namespace skiatest | 1220 } // namespace skiatest |
| 1221 | 1221 |
| 1222 #if !defined(SK_BUILD_FOR_IOS) | 1222 #if !defined(SK_BUILD_FOR_IOS) |
| 1223 int main(int argc, char** argv) { | 1223 int main(int argc, char** argv) { |
| 1224 SkCommandLineFlags::Parse(argc, argv); | 1224 SkCommandLineFlags::Parse(argc, argv); |
| 1225 return dm_main(); | 1225 return dm_main(); |
| 1226 } | 1226 } |
| 1227 #endif | 1227 #endif |
| OLD | NEW |