OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkEndian.h" | 10 #include "SkEndian.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 SkAutoMalloc decompMemory(kWidth*kHeight); | 125 SkAutoMalloc decompMemory(kWidth*kHeight); |
126 uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get()); | 126 uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get()); |
127 REPORTER_ASSERT(reporter, NULL != decompBuffer); | 127 REPORTER_ASSERT(reporter, NULL != decompBuffer); |
128 if (NULL == decompBuffer) { | 128 if (NULL == decompBuffer) { |
129 return; | 129 return; |
130 } | 130 } |
131 | 131 |
132 for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) { | 132 for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) { |
133 const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor:
:Format>(i); | 133 const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor:
:Format>(i); |
134 | 134 |
135 // ASTC is for RGBA data, and the decompressed buffer | 135 // Ignore formats for RGBA data, since the decompressed buffer |
136 // won't match the size and contents of the original. | 136 // won't match the size and contents of the original. |
137 // TODO: Create separate tests for RGB and RGBA data once | 137 // TODO: Create separate tests for RGB and RGBA data once |
138 // ASTC decompression is implemented. | 138 // ASTC and ETC1 decompression is implemented. |
139 if (SkTextureCompressor::kASTC_12x12_Format == fmt) { | 139 if (SkTextureCompressor::kASTC_12x12_Format == fmt || |
| 140 SkTextureCompressor::kETC1_Format == fmt) { |
140 continue; | 141 continue; |
141 } | 142 } |
142 | 143 |
143 SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap,
fmt)); | 144 SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap,
fmt)); |
144 REPORTER_ASSERT(reporter, NULL != data); | 145 REPORTER_ASSERT(reporter, NULL != data); |
145 if (NULL == data) { | 146 if (NULL == data) { |
146 continue; | 147 continue; |
147 } | 148 } |
148 | 149 |
149 bool decompResult = | 150 bool decompResult = |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 (kIndex << 28) | (kIndex << 31) | (kIndex << 34) | (kIndex << 37
) | | 238 (kIndex << 28) | (kIndex << 31) | (kIndex << 34) | (kIndex << 37
) | |
238 (kIndex << 40) | (kIndex << 43) | (kIndex << 46) | (kIndex << 49
) | | 239 (kIndex << 40) | (kIndex << 43) | (kIndex << 46) | (kIndex << 49
) | |
239 (kIndex << 52) | (kIndex << 55) | (kIndex << 58) | (kIndex << 61
)); | 240 (kIndex << 52) | (kIndex << 55) | (kIndex << 58) | (kIndex << 61
)); |
240 | 241 |
241 const uint64_t* blockPtr = reinterpret_cast<const uint64_t*>(latcData->d
ata()); | 242 const uint64_t* blockPtr = reinterpret_cast<const uint64_t*>(latcData->d
ata()); |
242 for (size_t i = 0; i < (kSizeToBe/8); ++i) { | 243 for (size_t i = 0; i < (kSizeToBe/8); ++i) { |
243 REPORTER_ASSERT(reporter, blockPtr[i] == kConstColorEncoding); | 244 REPORTER_ASSERT(reporter, blockPtr[i] == kConstColorEncoding); |
244 } | 245 } |
245 } | 246 } |
246 } | 247 } |
OLD | NEW |