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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 typedef SkData *(*CompressBitmapProc)(const SkBitmap &bitmap); | 191 typedef SkData *(*CompressBitmapProc)(const SkBitmap &bitmap); |
192 | 192 |
193 SkData *CompressBitmapToFormat(const SkBitmap &bitmap, Format format) { | 193 SkData *CompressBitmapToFormat(const SkBitmap &bitmap, Format format) { |
194 SkAutoLockPixels alp(bitmap); | 194 SkAutoLockPixels alp(bitmap); |
195 | 195 |
196 CompressBitmapProc kProcMap[kLastEnum_SkColorType + 1][kFormatCnt]; | 196 CompressBitmapProc kProcMap[kLastEnum_SkColorType + 1][kFormatCnt]; |
197 memset(kProcMap, 0, sizeof(kProcMap)); | 197 memset(kProcMap, 0, sizeof(kProcMap)); |
198 | 198 |
199 // Map available bitmap configs to compression functions | 199 // Map available bitmap configs to compression functions |
200 kProcMap[SkBitmap::kA8_Config][kLATC_Format] = compress_a8_to_latc; | 200 kProcMap[kAlpha_8_SkColorType][kLATC_Format] = compress_a8_to_latc; |
201 | 201 |
202 CompressBitmapProc proc = kProcMap[bitmap.colorType()][format]; | 202 CompressBitmapProc proc = kProcMap[bitmap.colorType()][format]; |
203 if (NULL != proc) { | 203 if (NULL != proc) { |
204 return proc(bitmap); | 204 return proc(bitmap); |
205 } | 205 } |
206 | 206 |
207 return NULL; | 207 return NULL; |
208 } | 208 } |
209 | 209 |
210 } // namespace SkTextureCompressor | 210 } // namespace SkTextureCompressor |
OLD | NEW |