OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 check(r, "mandrill_16.png", SkISize::Make(16, 16), true, false, false); | 430 check(r, "mandrill_16.png", SkISize::Make(16, 16), true, false, false); |
431 check(r, "mandrill_256.png", SkISize::Make(256, 256), true, false, false); | 431 check(r, "mandrill_256.png", SkISize::Make(256, 256), true, false, false); |
432 check(r, "mandrill_32.png", SkISize::Make(32, 32), true, false, false); | 432 check(r, "mandrill_32.png", SkISize::Make(32, 32), true, false, false); |
433 check(r, "mandrill_512.png", SkISize::Make(512, 512), true, false, false); | 433 check(r, "mandrill_512.png", SkISize::Make(512, 512), true, false, false); |
434 check(r, "mandrill_64.png", SkISize::Make(64, 64), true, false, false); | 434 check(r, "mandrill_64.png", SkISize::Make(64, 64), true, false, false); |
435 check(r, "plane.png", SkISize::Make(250, 126), true, false, false); | 435 check(r, "plane.png", SkISize::Make(250, 126), true, false, false); |
436 // FIXME: We are not ready to test incomplete interlaced pngs | 436 // FIXME: We are not ready to test incomplete interlaced pngs |
437 check(r, "plane_interlaced.png", SkISize::Make(250, 126), true, false, false
); | 437 check(r, "plane_interlaced.png", SkISize::Make(250, 126), true, false, false
); |
438 check(r, "randPixels.png", SkISize::Make(8, 8), true, false, false); | 438 check(r, "randPixels.png", SkISize::Make(8, 8), true, false, false); |
439 check(r, "yellow_rose.png", SkISize::Make(400, 301), true, false, false); | 439 check(r, "yellow_rose.png", SkISize::Make(400, 301), true, false, false); |
| 440 |
| 441 // RAW |
| 442 check(r, "sample_1mp.dng", SkISize::Make(600, 338), false, false); |
440 } | 443 } |
441 | 444 |
442 // Test interlaced PNG in stripes, similar to DM's kStripe_Mode | 445 // Test interlaced PNG in stripes, similar to DM's kStripe_Mode |
443 DEF_TEST(Codec_stripes, r) { | 446 DEF_TEST(Codec_stripes, r) { |
444 const char * path = "plane_interlaced.png"; | 447 const char * path = "plane_interlaced.png"; |
445 SkAutoTDelete<SkStream> stream(resource(path)); | 448 SkAutoTDelete<SkStream> stream(resource(path)); |
446 if (!stream) { | 449 if (!stream) { |
447 SkDebugf("Missing resource '%s'\n", path); | 450 SkDebugf("Missing resource '%s'\n", path); |
448 } | 451 } |
449 | 452 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // performing scaled decodes on small images. | 626 // performing scaled decodes on small images. |
624 test_dimensions(r, "1x1.png"); | 627 test_dimensions(r, "1x1.png"); |
625 test_dimensions(r, "2x2.png"); | 628 test_dimensions(r, "2x2.png"); |
626 test_dimensions(r, "3x3.png"); | 629 test_dimensions(r, "3x3.png"); |
627 test_dimensions(r, "3x1.png"); | 630 test_dimensions(r, "3x1.png"); |
628 test_dimensions(r, "1x1.png"); | 631 test_dimensions(r, "1x1.png"); |
629 test_dimensions(r, "16x1.png"); | 632 test_dimensions(r, "16x1.png"); |
630 test_dimensions(r, "1x16.png"); | 633 test_dimensions(r, "1x16.png"); |
631 test_dimensions(r, "mandrill_16.png"); | 634 test_dimensions(r, "mandrill_16.png"); |
632 | 635 |
| 636 // RAW |
| 637 test_dimensions(r, "sample_1mp.dng"); |
633 } | 638 } |
634 | 639 |
635 static void test_invalid(skiatest::Reporter* r, const char path[]) { | 640 static void test_invalid(skiatest::Reporter* r, const char path[]) { |
636 SkAutoTDelete<SkStream> stream(resource(path)); | 641 SkAutoTDelete<SkStream> stream(resource(path)); |
637 if (!stream) { | 642 if (!stream) { |
638 SkDebugf("Missing resource '%s'\n", path); | 643 SkDebugf("Missing resource '%s'\n", path); |
639 return; | 644 return; |
640 } | 645 } |
641 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); | 646 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); |
642 REPORTER_ASSERT(r, nullptr == codec); | 647 REPORTER_ASSERT(r, nullptr == codec); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // Now test an image which is too big. Any image with a larger header (i.e. | 952 // Now test an image which is too big. Any image with a larger header (i.e. |
948 // has bigger width/height) is also too big. | 953 // has bigger width/height) is also too big. |
949 const unsigned char tooBigWbmp[] = { 0x00, 0x00, // Header | 954 const unsigned char tooBigWbmp[] = { 0x00, 0x00, // Header |
950 0x84, 0x80, 0x00, // W: 65536 | 955 0x84, 0x80, 0x00, // W: 65536 |
951 0x84, 0x80, 0x00 }; // H: 65536 | 956 0x84, 0x80, 0x00 }; // H: 65536 |
952 stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false)); | 957 stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false)); |
953 codec.reset(SkCodec::NewFromStream(stream.detach())); | 958 codec.reset(SkCodec::NewFromStream(stream.detach())); |
954 | 959 |
955 REPORTER_ASSERT(r, !codec); | 960 REPORTER_ASSERT(r, !codec); |
956 } | 961 } |
OLD | NEW |