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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bm.eraseColor(SK_ColorYELLOW); | 61 bm.eraseColor(SK_ColorYELLOW); |
62 | 62 |
63 result = | 63 result = |
64 codec->getPixels(info, bm.getPixels(), bm.rowBytes(), NULL, NULL, NULL); | 64 codec->getPixels(info, bm.getPixels(), bm.rowBytes(), NULL, NULL, NULL); |
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, NULL, N
ULL, NULL); |
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 for (int y = 0; y < info.height(); y++) { | 75 for (int y = 0; y < info.height(); y++) { |
76 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); | 76 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); |
77 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); | 77 REPORTER_ASSERT(r, result == SkImageGenerator::kSuccess); |
78 } | 78 } |
79 // verify that scanline decoding gives the same result. | 79 // verify that scanline decoding gives the same result. |
80 SkMD5::Digest digest3; | 80 SkMD5::Digest digest3; |
81 md5(bm, &digest3); | 81 md5(bm, &digest3); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // JPG | 191 // JPG |
192 test_dimensions(r, "CMYK.jpg"); | 192 test_dimensions(r, "CMYK.jpg"); |
193 test_dimensions(r, "color_wheel.jpg"); | 193 test_dimensions(r, "color_wheel.jpg"); |
194 test_dimensions(r, "grayscale.jpg"); | 194 test_dimensions(r, "grayscale.jpg"); |
195 test_dimensions(r, "mandrill_512_q075.jpg"); | 195 test_dimensions(r, "mandrill_512_q075.jpg"); |
196 test_dimensions(r, "randPixels.jpg"); | 196 test_dimensions(r, "randPixels.jpg"); |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 | 200 |
OLD | NEW |