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 "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
11 #include "SkCodec.h" | 11 #include "SkCodec.h" |
12 #include "SkCodecImageGenerator.h" | 12 #include "SkCodecImageGenerator.h" |
| 13 #include "SkColorSpace_Base.h" |
13 #include "SkData.h" | 14 #include "SkData.h" |
14 #include "SkImageEncoder.h" | 15 #include "SkImageEncoder.h" |
15 #include "SkFrontBufferedStream.h" | 16 #include "SkFrontBufferedStream.h" |
16 #include "SkMD5.h" | 17 #include "SkMD5.h" |
17 #include "SkRandom.h" | 18 #include "SkRandom.h" |
18 #include "SkStream.h" | 19 #include "SkStream.h" |
19 #include "SkStreamPriv.h" | 20 #include "SkStreamPriv.h" |
20 #include "SkPngChunkReader.h" | 21 #include "SkPngChunkReader.h" |
21 #include "Test.h" | 22 #include "Test.h" |
22 | 23 |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); | 1185 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); |
1185 } | 1186 } |
1186 | 1187 |
1187 result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes(
)); | 1188 result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes(
)); |
1188 if (supportsIncrementalDecoder) { | 1189 if (supportsIncrementalDecoder) { |
1189 REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result); | 1190 REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result); |
1190 } else { | 1191 } else { |
1191 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); | 1192 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); |
1192 } | 1193 } |
1193 | 1194 |
1194 infoF16 = infoF16.makeColorSpace(infoF16.colorSpace()->makeLinearGamma()); | 1195 infoF16 = infoF16.makeColorSpace(as_CSB(infoF16.colorSpace())->makeLinearGam
ma()); |
1195 result = codec->getPixels(infoF16, bm.getPixels(), bm.rowBytes()); | 1196 result = codec->getPixels(infoF16, bm.getPixels(), bm.rowBytes()); |
1196 REPORTER_ASSERT(r, SkCodec::kSuccess == result); | 1197 REPORTER_ASSERT(r, SkCodec::kSuccess == result); |
1197 result = codec->startScanlineDecode(infoF16); | 1198 result = codec->startScanlineDecode(infoF16); |
1198 if (supportsScanlineDecoder) { | 1199 if (supportsScanlineDecoder) { |
1199 REPORTER_ASSERT(r, SkCodec::kSuccess == result); | 1200 REPORTER_ASSERT(r, SkCodec::kSuccess == result); |
1200 } else { | 1201 } else { |
1201 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); | 1202 REPORTER_ASSERT(r, SkCodec::kUnimplemented == result); |
1202 } | 1203 } |
1203 | 1204 |
1204 result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes(
)); | 1205 result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes(
)); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 auto result = codec->startIncrementalDecode(info, bm.getPixels(), bm.rowByte
s()); | 1355 auto result = codec->startIncrementalDecode(info, bm.getPixels(), bm.rowByte
s()); |
1355 REPORTER_ASSERT(r, result == SkCodec::kSuccess); | 1356 REPORTER_ASSERT(r, result == SkCodec::kSuccess); |
1356 | 1357 |
1357 // This is an arbitrary value. The important fact is that it is not zero, an
d rowsDecoded | 1358 // This is an arbitrary value. The important fact is that it is not zero, an
d rowsDecoded |
1358 // should get set to zero by incrementalDecode. | 1359 // should get set to zero by incrementalDecode. |
1359 int rowsDecoded = 77; | 1360 int rowsDecoded = 77; |
1360 result = codec->incrementalDecode(&rowsDecoded); | 1361 result = codec->incrementalDecode(&rowsDecoded); |
1361 REPORTER_ASSERT(r, result == SkCodec::kIncompleteInput); | 1362 REPORTER_ASSERT(r, result == SkCodec::kIncompleteInput); |
1362 REPORTER_ASSERT(r, rowsDecoded == 0); | 1363 REPORTER_ASSERT(r, rowsDecoded == 0); |
1363 } | 1364 } |
OLD | NEW |