OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 /* Fill out buffer with the compressed format Ganesh expects from a colortable | 10 /* Fill out buffer with the compressed format Ganesh expects from a colortable |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 result = sk_gr_create_bitmap_texture(ctx, cache, params, bitmap); | 182 result = sk_gr_create_bitmap_texture(ctx, cache, params, bitmap); |
183 } | 183 } |
184 if (NULL == result) { | 184 if (NULL == result) { |
185 GrPrintf("---- failed to create texture for cache [%d %d]\n", | 185 GrPrintf("---- failed to create texture for cache [%d %d]\n", |
186 bitmap.width(), bitmap.height()); | 186 bitmap.width(), bitmap.height()); |
187 } | 187 } |
188 return result; | 188 return result; |
189 } | 189 } |
190 | 190 |
191 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { | 191 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { |
192 GrAssert(NULL != texture->getContext()); | 192 SkASSERT(NULL != texture->getContext()); |
193 | 193 |
194 texture->getContext()->unlockScratchTexture(texture); | 194 texture->getContext()->unlockScratchTexture(texture); |
195 texture->unref(); | 195 texture->unref(); |
196 } | 196 } |
197 | 197 |
198 /////////////////////////////////////////////////////////////////////////////// | 198 /////////////////////////////////////////////////////////////////////////////// |
199 | 199 |
200 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) { | 200 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) { |
201 switch (config) { | 201 switch (config) { |
202 case SkBitmap::kA8_Config: | 202 case SkBitmap::kA8_Config: |
203 return kAlpha_8_GrPixelConfig; | 203 return kAlpha_8_GrPixelConfig; |
204 case SkBitmap::kIndex8_Config: | 204 case SkBitmap::kIndex8_Config: |
205 return kIndex_8_GrPixelConfig; | 205 return kIndex_8_GrPixelConfig; |
206 case SkBitmap::kRGB_565_Config: | 206 case SkBitmap::kRGB_565_Config: |
207 return kRGB_565_GrPixelConfig; | 207 return kRGB_565_GrPixelConfig; |
208 case SkBitmap::kARGB_4444_Config: | 208 case SkBitmap::kARGB_4444_Config: |
209 return kRGBA_4444_GrPixelConfig; | 209 return kRGBA_4444_GrPixelConfig; |
210 case SkBitmap::kARGB_8888_Config: | 210 case SkBitmap::kARGB_8888_Config: |
211 return kSkia8888_GrPixelConfig; | 211 return kSkia8888_GrPixelConfig; |
212 default: | 212 default: |
213 // kNo_Config, kA1_Config missing | 213 // kNo_Config, kA1_Config missing |
214 return kUnknown_GrPixelConfig; | 214 return kUnknown_GrPixelConfig; |
215 } | 215 } |
216 } | 216 } |
OLD | NEW |