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

Side by Side Diff: tests/CodexTest.cpp

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 5 years, 3 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 stream.reset(resource(path)); 150 stream.reset(resource(path));
151 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( 151 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
152 SkScanlineDecoder::NewFromStream(stream.detach())); 152 SkScanlineDecoder::NewFromStream(stream.detach()));
153 if (supportsScanlineDecoding) { 153 if (supportsScanlineDecoding) {
154 bm.eraseColor(SK_ColorYELLOW); 154 bm.eraseColor(SK_ColorYELLOW);
155 REPORTER_ASSERT(r, scanlineDecoder); 155 REPORTER_ASSERT(r, scanlineDecoder);
156 156
157 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess); 157 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess);
158 158
159 for (int y = 0; y < info.height(); y++) { 159 for (int y = 0; y < info.height(); y++) {
160 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); 160 const uint32_t lines = scanlineDecoder->getScanlines(bm.getAddr(0, y ), 1, 0);
161 REPORTER_ASSERT(r, result == SkCodec::kSuccess); 161 REPORTER_ASSERT(r, 1 == lines);
162 } 162 }
163 // verify that scanline decoding gives the same result. 163 // verify that scanline decoding gives the same result.
164 if (SkScanlineDecoder::kTopDown_SkScanlineOrder == scanlineDecoder->getS canlineOrder()) { 164 if (SkScanlineDecoder::kTopDown_SkScanlineOrder == scanlineDecoder->getS canlineOrder()) {
165 compare_to_good_digest(r, digest, bm); 165 compare_to_good_digest(r, digest, bm);
166 } 166 }
167 } else { 167 } else {
168 REPORTER_ASSERT(r, !scanlineDecoder); 168 REPORTER_ASSERT(r, !scanlineDecoder);
169 } 169 }
170 170
171 // The rest of this function tests decoding subsets, and will decode an arbi trary number of 171 // The rest of this function tests decoding subsets, and will decode an arbi trary number of
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 390 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
391 result = decoder->start( 391 result = decoder->start(
392 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); 392 decoder->getInfo().makeColorType(kIndex_8_SkColorType));
393 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 393 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
394 } 394 }
395 395
396 DEF_TEST(Codec_Params, r) { 396 DEF_TEST(Codec_Params, r) {
397 test_invalid_parameters(r, "index8.png"); 397 test_invalid_parameters(r, "index8.png");
398 test_invalid_parameters(r, "mandrill.wbmp"); 398 test_invalid_parameters(r, "mandrill.wbmp");
399 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698