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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); | 66 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); |
67 // verify that re-decoding gives the same result. | 67 // verify that re-decoding gives the same result. |
68 md5(bm, &digest2); | 68 md5(bm, &digest2); |
69 REPORTER_ASSERT(r, digest1 == digest2); | 69 REPORTER_ASSERT(r, digest1 == digest2); |
70 | 70 |
71 SkScanlineDecoder* scanlineDecoder = codec->getScanlineDecoder(info); | 71 SkScanlineDecoder* scanlineDecoder = codec->getScanlineDecoder(info); |
72 if (supportsScanlineDecoding) { | 72 if (supportsScanlineDecoding) { |
73 bm.eraseColor(SK_ColorYELLOW); | 73 bm.eraseColor(SK_ColorYELLOW); |
74 REPORTER_ASSERT(r, scanlineDecoder); | 74 REPORTER_ASSERT(r, scanlineDecoder); |
| 75 |
| 76 // Regular decodes should be disabled after creating a scanline decoder |
| 77 result = codec->getPixels(info, bm.getPixels(), bm.rowBytes(), NULL, NUL
L, NULL); |
| 78 REPORTER_ASSERT(r, SkImageGenerator::kInvalidParameters == result); |
75 for (int y = 0; y < info.height(); y++) { | 79 for (int y = 0; y < info.height(); y++) { |
76 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); | 80 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); |
77 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); | 81 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); |
78 } | 82 } |
79 // verify that scanline decoding gives the same result. | 83 // verify that scanline decoding gives the same result. |
80 SkMD5::Digest digest3; | 84 SkMD5::Digest digest3; |
81 md5(bm, &digest3); | 85 md5(bm, &digest3); |
82 REPORTER_ASSERT(r, digest3 == digest1); | 86 REPORTER_ASSERT(r, digest3 == digest1); |
83 } else { | 87 } else { |
84 REPORTER_ASSERT(r, !scanlineDecoder); | 88 REPORTER_ASSERT(r, !scanlineDecoder); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 test_empty(r, "empty_images/zero-embedded.ico"); | 221 test_empty(r, "empty_images/zero-embedded.ico"); |
218 test_empty(r, "empty_images/zero-width.bmp"); | 222 test_empty(r, "empty_images/zero-width.bmp"); |
219 test_empty(r, "empty_images/zero-height.bmp"); | 223 test_empty(r, "empty_images/zero-height.bmp"); |
220 test_empty(r, "empty_images/zero-width.jpg"); | 224 test_empty(r, "empty_images/zero-width.jpg"); |
221 test_empty(r, "empty_images/zero-height.jpg"); | 225 test_empty(r, "empty_images/zero-height.jpg"); |
222 test_empty(r, "empty_images/zero-width.png"); | 226 test_empty(r, "empty_images/zero-width.png"); |
223 test_empty(r, "empty_images/zero-height.png"); | 227 test_empty(r, "empty_images/zero-height.png"); |
224 test_empty(r, "empty_images/zero-width.wbmp"); | 228 test_empty(r, "empty_images/zero-width.wbmp"); |
225 test_empty(r, "empty_images/zero-height.wbmp"); | 229 test_empty(r, "empty_images/zero-height.wbmp"); |
226 } | 230 } |
OLD | NEW |