| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 test_dimensions(r, "1x1.png"); | 642 test_dimensions(r, "1x1.png"); |
| 643 test_dimensions(r, "2x2.png"); | 643 test_dimensions(r, "2x2.png"); |
| 644 test_dimensions(r, "3x3.png"); | 644 test_dimensions(r, "3x3.png"); |
| 645 test_dimensions(r, "3x1.png"); | 645 test_dimensions(r, "3x1.png"); |
| 646 test_dimensions(r, "1x1.png"); | 646 test_dimensions(r, "1x1.png"); |
| 647 test_dimensions(r, "16x1.png"); | 647 test_dimensions(r, "16x1.png"); |
| 648 test_dimensions(r, "1x16.png"); | 648 test_dimensions(r, "1x16.png"); |
| 649 test_dimensions(r, "mandrill_16.png"); | 649 test_dimensions(r, "mandrill_16.png"); |
| 650 | 650 |
| 651 // RAW | 651 // RAW |
| 652 #if defined(SK_CODEC_DECODES_RAW) |
| 652 test_dimensions(r, "sample_1mp.dng"); | 653 test_dimensions(r, "sample_1mp.dng"); |
| 654 #endif |
| 653 } | 655 } |
| 654 | 656 |
| 655 static void test_invalid(skiatest::Reporter* r, const char path[]) { | 657 static void test_invalid(skiatest::Reporter* r, const char path[]) { |
| 656 SkAutoTDelete<SkStream> stream(resource(path)); | 658 SkAutoTDelete<SkStream> stream(resource(path)); |
| 657 if (!stream) { | 659 if (!stream) { |
| 658 SkDebugf("Missing resource '%s'\n", path); | 660 SkDebugf("Missing resource '%s'\n", path); |
| 659 return; | 661 return; |
| 660 } | 662 } |
| 661 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); | 663 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); |
| 662 REPORTER_ASSERT(r, nullptr == codec); | 664 REPORTER_ASSERT(r, nullptr == codec); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 // Now test an image which is too big. Any image with a larger header (i.e. | 969 // Now test an image which is too big. Any image with a larger header (i.e. |
| 968 // has bigger width/height) is also too big. | 970 // has bigger width/height) is also too big. |
| 969 const unsigned char tooBigWbmp[] = { 0x00, 0x00, // Header | 971 const unsigned char tooBigWbmp[] = { 0x00, 0x00, // Header |
| 970 0x84, 0x80, 0x00, // W: 65536 | 972 0x84, 0x80, 0x00, // W: 65536 |
| 971 0x84, 0x80, 0x00 }; // H: 65536 | 973 0x84, 0x80, 0x00 }; // H: 65536 |
| 972 stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false)); | 974 stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false)); |
| 973 codec.reset(SkCodec::NewFromStream(stream.detach())); | 975 codec.reset(SkCodec::NewFromStream(stream.detach())); |
| 974 | 976 |
| 975 REPORTER_ASSERT(r, !codec); | 977 REPORTER_ASSERT(r, !codec); |
| 976 } | 978 } |
| OLD | NEW |