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

Side by Side Diff: src/utils/SkTextureCompressor.cpp

Issue 425223006: Revert of Add initial pipeline for decompressors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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.h ('k') | src/utils/SkTextureCompressor_LATC.h » ('j') | 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 "SkTextureCompressor.h" 8 #include "SkTextureCompressor.h"
9 #include "SkTextureCompressor_ASTC.h" 9 #include "SkTextureCompressor_ASTC.h"
10 #include "SkTextureCompressor_LATC.h" 10 #include "SkTextureCompressor_LATC.h"
11 #include "SkTextureCompressor_R11EAC.h" 11 #include "SkTextureCompressor_R11EAC.h"
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkData.h" 14 #include "SkData.h"
15 #include "SkEndian.h" 15 #include "SkEndian.h"
16 16
17 #include "SkTextureCompression_opts.h" 17 #include "SkTextureCompression_opts.h"
18 18
19 //////////////////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////////////////
20 20
21 namespace SkTextureCompressor { 21 namespace SkTextureCompressor {
22 22
23 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec) { 23 void GetBlockDimensions(Format format, int* dimX, int* dimY) {
24 if (NULL == dimX || NULL == dimY) { 24 if (NULL == dimX || NULL == dimY) {
25 return; 25 return;
26 } 26 }
27 27
28 if (!matchSpec && SkTextureCompressorGetPlatformDims(format, dimX, dimY)) { 28 if (SkTextureCompressorGetPlatformDims(format, dimX, dimY)) {
29 return; 29 return;
30 } 30 }
31 31
32 // No specialized arguments, return the dimensions as they are in the spec.
33 switch(format) { 32 switch(format) {
34 // These formats are 64 bits per 4x4 block. 33 // These formats are 64 bits per 4x4 block.
35 default: 34 default:
36 SkDEBUGFAIL("Unknown compression format!"); 35 SkDEBUGFAIL("Unknown compression format!");
37 // fall through 36 // fall through
38 case kR11_EAC_Format: 37 case kR11_EAC_Format:
39 case kLATC_Format: 38 case kLATC_Format:
40 *dimX = 4; 39 *dimX = 4;
41 *dimY = 4; 40 *dimY = 4;
42 break; 41 break;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 case kASTC_12x12_Format: 152 case kASTC_12x12_Format:
154 return CreateASTCBlitter(width, height, compressedBuffer); 153 return CreateASTCBlitter(width, height, compressedBuffer);
155 154
156 default: 155 default:
157 return NULL; 156 return NULL;
158 } 157 }
159 158
160 return NULL; 159 return NULL;
161 } 160 }
162 161
163 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* sr c,
164 int width, int height, Format format) {
165 int dimX, dimY;
166 GetBlockDimensions(format, &dimX, &dimY, true);
167
168 if (width < 0 || ((width % dimX) != 0) || height < 0 || ((height % dimY) != 0)) {
169 return false;
170 }
171
172 switch(format) {
173 case kLATC_Format:
174 DecompressLATC(dst, dstRowBytes, src, width, height);
175 return true;
176
177 case kR11_EAC_Format:
178 DecompressR11EAC(dst, dstRowBytes, src, width, height);
179 return true;
180
181 case kASTC_12x12_Format:
182 // TODO(krajcevski) .. right now just fall through and return false.
183 return false;
184 }
185
186 return false;
187 }
188
189 } // namespace SkTextureCompressor 162 } // namespace SkTextureCompressor
OLDNEW
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | src/utils/SkTextureCompressor_LATC.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698