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

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: 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 stream.reset(resource(path)); 147 stream.reset(resource(path));
148 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( 148 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
149 SkScanlineDecoder::NewFromStream(stream.detach())); 149 SkScanlineDecoder::NewFromStream(stream.detach()));
150 if (supportsScanlineDecoding) { 150 if (supportsScanlineDecoding) {
151 bm.eraseColor(SK_ColorYELLOW); 151 bm.eraseColor(SK_ColorYELLOW);
152 REPORTER_ASSERT(r, scanlineDecoder); 152 REPORTER_ASSERT(r, scanlineDecoder);
153 153
154 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess); 154 REPORTER_ASSERT(r, scanlineDecoder->start(info) == SkCodec::kSuccess);
155 155
156 for (int y = 0; y < info.height(); y++) { 156 for (int y = 0; y < info.height(); y++) {
157 result = scanlineDecoder->getScanlines(bm.getAddr(0, y), 1, 0); 157 const uint32_t lines = scanlineDecoder->getScanlines(bm.getAddr(0, y ), 1, 0);
158 REPORTER_ASSERT(r, result == SkCodec::kSuccess); 158 REPORTER_ASSERT(r, 1 == lines);
159 } 159 }
160 // verify that scanline decoding gives the same result. 160 // verify that scanline decoding gives the same result.
161 if (SkScanlineDecoder::kTopDown_SkScanlineOrder == scanlineDecoder->getS canlineOrder()) { 161 if (SkScanlineDecoder::kTopDown_SkScanlineOrder == scanlineDecoder->getS canlineOrder()) {
162 compare_to_good_digest(r, digest, bm); 162 compare_to_good_digest(r, digest, bm);
163 } 163 }
164 } else { 164 } else {
165 REPORTER_ASSERT(r, !scanlineDecoder); 165 REPORTER_ASSERT(r, !scanlineDecoder);
166 } 166 }
167 167
168 // The rest of this function tests decoding subsets, and will decode an arbi trary number of 168 // 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
387 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 387 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
388 result = decoder->start( 388 result = decoder->start(
389 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); 389 decoder->getInfo().makeColorType(kIndex_8_SkColorType));
390 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 390 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
391 } 391 }
392 392
393 DEF_TEST(Codec_Params, r) { 393 DEF_TEST(Codec_Params, r) {
394 test_invalid_parameters(r, "index8.png"); 394 test_invalid_parameters(r, "index8.png");
395 test_invalid_parameters(r, "mandrill.wbmp"); 395 test_invalid_parameters(r, "mandrill.wbmp");
396 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698