| 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 "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // are violating those assumptions. And if we are, then we're also violating
the | 51 // are violating those assumptions. And if we are, then we're also violating
the |
| 52 // assumptions of ASTC, which is 12x12 since any number not divisible by 4 i
s | 52 // assumptions of ASTC, which is 12x12 since any number not divisible by 4 i
s |
| 53 // also not divisible by 12. Our dimensions are prime, so any block dimensio
n | 53 // also not divisible by 12. Our dimensions are prime, so any block dimensio
n |
| 54 // larger than 1 should fail. | 54 // larger than 1 should fail. |
| 55 REPORTER_ASSERT(reporter, kWidth % 4 != 0); | 55 REPORTER_ASSERT(reporter, kWidth % 4 != 0); |
| 56 REPORTER_ASSERT(reporter, kHeight % 4 != 0); | 56 REPORTER_ASSERT(reporter, kHeight % 4 != 0); |
| 57 | 57 |
| 58 SkAutoPixmapStorage pixmap; | 58 SkAutoPixmapStorage pixmap; |
| 59 pixmap.alloc(SkImageInfo::MakeA8(kWidth, kHeight)); | 59 pixmap.alloc(SkImageInfo::MakeA8(kWidth, kHeight)); |
| 60 // leaving the pixels uninitialized, as they don't affect the test... | 60 // leaving the pixels uninitialized, as they don't affect the test... |
| 61 | 61 |
| 62 for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) { | 62 for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) { |
| 63 const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor:
:Format>(i); | 63 const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor:
:Format>(i); |
| 64 if (!compresses_a8(fmt)) { | 64 if (!compresses_a8(fmt)) { |
| 65 continue; | 65 continue; |
| 66 } | 66 } |
| 67 SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap,
fmt)); | 67 SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap,
fmt)); |
| 68 REPORTER_ASSERT(reporter, nullptr == data); | 68 REPORTER_ASSERT(reporter, nullptr == data); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 (kIndex << 28) | (kIndex << 31) | (kIndex << 34) | (kIndex << 37
) | | 268 (kIndex << 28) | (kIndex << 31) | (kIndex << 34) | (kIndex << 37
) | |
| 269 (kIndex << 40) | (kIndex << 43) | (kIndex << 46) | (kIndex << 49
) | | 269 (kIndex << 40) | (kIndex << 43) | (kIndex << 46) | (kIndex << 49
) | |
| 270 (kIndex << 52) | (kIndex << 55) | (kIndex << 58) | (kIndex << 61
)); | 270 (kIndex << 52) | (kIndex << 55) | (kIndex << 58) | (kIndex << 61
)); |
| 271 | 271 |
| 272 const uint64_t* blockPtr = reinterpret_cast<const uint64_t*>(latcData->d
ata()); | 272 const uint64_t* blockPtr = reinterpret_cast<const uint64_t*>(latcData->d
ata()); |
| 273 for (size_t i = 0; i < (kSizeToBe/8); ++i) { | 273 for (size_t i = 0; i < (kSizeToBe/8); ++i) { |
| 274 REPORTER_ASSERT(reporter, blockPtr[i] == kConstColorEncoding); | 274 REPORTER_ASSERT(reporter, blockPtr[i] == kConstColorEncoding); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 } | 277 } |
| OLD | NEW |