Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: tests/CodexTest.cpp

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bm.eraseColor(SK_ColorYELLOW); 150 bm.eraseColor(SK_ColorYELLOW);
151 REPORTER_ASSERT(r, scanlineDecoder); 151 REPORTER_ASSERT(r, scanlineDecoder);
152 152
153 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess); 153 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess);
154 154
155 for (int y = 0; y < info.height(); y++) { 155 for (int y = 0; y < info.height(); y++) {
156 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); 156 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0);
157 REPORTER_ASSERT(r, result == SkCodec::kSuccess); 157 REPORTER_ASSERT(r, result == SkCodec::kSuccess);
158 } 158 }
159 // verify that scanline decoding gives the same result. 159 // verify that scanline decoding gives the same result.
160 compare_to_good_digest(r, digest, bm); 160 if (SkScanlineDecoder::kTopDown_SkScanlineOrder == scanlineDecoder->getS canlineOrder()) {
161 compare_to_good_digest(r, digest, bm);
162 }
161 } else { 163 } else {
162 REPORTER_ASSERT(r, !scanlineDecoder); 164 REPORTER_ASSERT(r, !scanlineDecoder);
163 } 165 }
164 166
165 // The rest of this function tests decoding subsets, and will decode an arbi trary number of 167 // The rest of this function tests decoding subsets, and will decode an arbi trary number of
166 // random subsets. 168 // random subsets.
167 // Do not attempt to decode subsets of an image of only once pixel, since th ere is no 169 // Do not attempt to decode subsets of an image of only once pixel, since th ere is no
168 // meaningful subset. 170 // meaningful subset.
169 if (size.width() * size.height() == 1) { 171 if (size.width() * size.height() == 1) {
170 return; 172 return;
(...skipping 30 matching lines...) Expand all
201 DEF_TEST(Codec, r) { 203 DEF_TEST(Codec, r) {
202 // WBMP 204 // WBMP
203 check(r, "mandrill.wbmp", SkISize::Make(512, 512), true, false); 205 check(r, "mandrill.wbmp", SkISize::Make(512, 512), true, false);
204 206
205 // WEBP 207 // WEBP
206 check(r, "baby_tux.webp", SkISize::Make(386, 395), false, true); 208 check(r, "baby_tux.webp", SkISize::Make(386, 395), false, true);
207 check(r, "color_wheel.webp", SkISize::Make(128, 128), false, true); 209 check(r, "color_wheel.webp", SkISize::Make(128, 128), false, true);
208 check(r, "yellow_rose.webp", SkISize::Make(400, 301), false, true); 210 check(r, "yellow_rose.webp", SkISize::Make(400, 301), false, true);
209 211
210 // BMP 212 // BMP
211 check(r, "randPixels.bmp", SkISize::Make(8, 8), false, false); 213 check(r, "randPixels.bmp", SkISize::Make(8, 8), true, false);
212 214
213 // ICO 215 // ICO
214 // These two tests examine interestingly different behavior: 216 // These two tests examine interestingly different behavior:
215 // Decodes an embedded BMP image 217 // Decodes an embedded BMP image
216 check(r, "color_wheel.ico", SkISize::Make(128, 128), false, false); 218 check(r, "color_wheel.ico", SkISize::Make(128, 128), false, false);
217 // Decodes an embedded PNG image 219 // Decodes an embedded PNG image
218 check(r, "google_chrome.ico", SkISize::Make(256, 256), false, false); 220 check(r, "google_chrome.ico", SkISize::Make(256, 256), false, false);
219 221
220 // GIF 222 // GIF
221 check(r, "box.gif", SkISize::Make(200, 55), false, false); 223 check(r, "box.gif", SkISize::Make(200, 55), false, false);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 369 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
368 result = decoder->start( 370 result = decoder->start(
369 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); 371 decoder->getInfo().makeColorType(kIndex_8_SkColorType));
370 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 372 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
371 } 373 }
372 374
373 DEF_TEST(Codec_Params, r) { 375 DEF_TEST(Codec_Params, r) {
374 test_invalid_parameters(r, "index8.png"); 376 test_invalid_parameters(r, "index8.png");
375 test_invalid_parameters(r, "mandrill.wbmp"); 377 test_invalid_parameters(r, "mandrill.wbmp");
376 } 378 }
OLDNEW
« src/codec/SkSwizzler.cpp ('K') | « src/codec/SkSwizzler.cpp ('k') | tests/SwizzlerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698