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

Side by Side Diff: tests/TextureCompressionTest.cpp

Issue 432143002: Add ETC1 format to SkTextureCompressor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default clause to texture compressor. Created 6 years, 4 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
« no previous file with comments | « src/utils/SkTextureCompressor.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/utils/SkTextureCompressor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698