| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 SkMD5::Digest digest; | 106 SkMD5::Digest digest; |
| 107 md5(bm, &digest); | 107 md5(bm, &digest); |
| 108 | 108 |
| 109 // verify that re-decoding gives the same result. | 109 // verify that re-decoding gives the same result. |
| 110 test_info(r, codec, info, SkCodec::kSuccess, &digest); | 110 test_info(r, codec, info, SkCodec::kSuccess, &digest); |
| 111 | 111 |
| 112 { | 112 { |
| 113 // Check alpha type conversions | 113 // Check alpha type conversions |
| 114 if (info.alphaType() == kOpaque_SkAlphaType) { | 114 if (info.alphaType() == kOpaque_SkAlphaType) { |
| 115 // Decoding to either premul or unpremul should succeed and look no
different |
| 116 test_info(r, codec, info.makeAlphaType(kUnpremul_SkAlphaType), SkCod
ec::kSuccess, |
| 117 &digest); |
| 118 test_info(r, codec, info.makeAlphaType(kPremul_SkAlphaType), SkCodec
::kSuccess, |
| 119 &digest); |
| 115 } else { | 120 } else { |
| 116 // Decoding to opaque should fail | 121 // Decoding to opaque should fail |
| 117 test_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType), | 122 test_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType), |
| 118 SkCodec::kInvalidConversion, NULL); | 123 SkCodec::kInvalidConversion, NULL); |
| 119 SkAlphaType otherAt = info.alphaType(); | 124 SkAlphaType otherAt = info.alphaType(); |
| 120 if (kPremul_SkAlphaType == otherAt) { | 125 if (kPremul_SkAlphaType == otherAt) { |
| 121 otherAt = kUnpremul_SkAlphaType; | 126 otherAt = kUnpremul_SkAlphaType; |
| 122 } else { | 127 } else { |
| 123 otherAt = kPremul_SkAlphaType; | 128 otherAt = kPremul_SkAlphaType; |
| 124 } | 129 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); | 356 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); |
| 352 result = decoder->start( | 357 result = decoder->start( |
| 353 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); | 358 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); |
| 354 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); | 359 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); |
| 355 } | 360 } |
| 356 | 361 |
| 357 DEF_TEST(Codec_Params, r) { | 362 DEF_TEST(Codec_Params, r) { |
| 358 test_invalid_parameters(r, "index8.png"); | 363 test_invalid_parameters(r, "index8.png"); |
| 359 test_invalid_parameters(r, "mandrill.wbmp"); | 364 test_invalid_parameters(r, "mandrill.wbmp"); |
| 360 } | 365 } |
| OLD | NEW |