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 "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 "SkBitmapProcShader.h" |
14 #include "SkData.h" | 15 #include "SkData.h" |
15 #include "SkEndian.h" | 16 #include "SkEndian.h" |
16 | 17 |
17 #include "SkTextureCompression_opts.h" | 18 #include "SkTextureCompression_opts.h" |
18 | 19 |
19 #ifndef SK_IGNORE_ETC1_SUPPORT | 20 #ifndef SK_IGNORE_ETC1_SUPPORT |
20 # include "etc1.h" | 21 # include "etc1.h" |
21 #endif | 22 #endif |
22 | 23 |
23 // Convert ETC1 functions to our function signatures | 24 // Convert ETC1 functions to our function signatures |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 if (CompressBufferToFormat(dst, src, bitmap.colorType(), bitmap.width(), bit
map.height(), | 167 if (CompressBufferToFormat(dst, src, bitmap.colorType(), bitmap.width(), bit
map.height(), |
167 bitmap.rowBytes(), format)) { | 168 bitmap.rowBytes(), format)) { |
168 return SkData::NewFromMalloc(dst, compressedDataSize); | 169 return SkData::NewFromMalloc(dst, compressedDataSize); |
169 } | 170 } |
170 | 171 |
171 sk_free(dst); | 172 sk_free(dst); |
172 return NULL; | 173 return NULL; |
173 } | 174 } |
174 | 175 |
175 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer,
Format format) { | 176 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer, |
| 177 SkTBlitterAllocator *allocator, Format format)
{ |
176 switch(format) { | 178 switch(format) { |
177 case kLATC_Format: | 179 case kLATC_Format: |
178 return CreateLATCBlitter(width, height, compressedBuffer); | 180 return CreateLATCBlitter(width, height, compressedBuffer, allocator)
; |
179 | 181 |
180 case kR11_EAC_Format: | 182 case kR11_EAC_Format: |
181 return CreateR11EACBlitter(width, height, compressedBuffer); | 183 return CreateR11EACBlitter(width, height, compressedBuffer, allocato
r); |
182 | 184 |
183 case kASTC_12x12_Format: | 185 case kASTC_12x12_Format: |
184 return CreateASTCBlitter(width, height, compressedBuffer); | 186 return CreateASTCBlitter(width, height, compressedBuffer, allocator)
; |
185 | 187 |
186 default: | 188 default: |
187 return NULL; | 189 return NULL; |
188 } | 190 } |
189 | 191 |
190 return NULL; | 192 return NULL; |
191 } | 193 } |
192 | 194 |
193 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* sr
c, | 195 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* sr
c, |
194 int width, int height, Format format) { | 196 int width, int height, Format format) { |
(...skipping 23 matching lines...) Expand all Loading... |
218 | 220 |
219 default: | 221 default: |
220 // Do nothing... | 222 // Do nothing... |
221 break; | 223 break; |
222 } | 224 } |
223 | 225 |
224 return false; | 226 return false; |
225 } | 227 } |
226 | 228 |
227 } // namespace SkTextureCompressor | 229 } // namespace SkTextureCompressor |
OLD | NEW |