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 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkConfig8888.h" | 10 #include "SkConfig8888.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } else { | 237 } else { |
238 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType); | 238 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType); |
239 // now bitmap points to our temp, which has been promoted to 32bits | 239 // now bitmap points to our temp, which has been promoted to 32bits |
240 bitmap = &tmpBitmap; | 240 bitmap = &tmpBitmap; |
241 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info()); | 241 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info()); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 // Is this an ETC1 encoded texture? | 245 // Is this an ETC1 encoded texture? |
246 #ifndef SK_IGNORE_ETC1_SUPPORT | 246 #ifndef SK_IGNORE_ETC1_SUPPORT |
247 else if (cache && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelCon
fig)) { | 247 else if ( |
| 248 // We do not support scratch ETC1 textures, hence they should all be at
least |
| 249 // trying to go to the cache. |
| 250 cache |
| 251 // Make sure that the underlying device supports ETC1 textures before we
go ahead |
| 252 // and check the data. |
| 253 && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelConfig) |
| 254 // If the bitmap had compressed data and was then uncompressed, it'll st
ill return |
| 255 // compressed data on 'refEncodedData' and upload it. Probably not good,
since if |
| 256 // the bitmap has available pixels, then they might not be what the deco
mpressed |
| 257 // data is. |
| 258 && !(bitmap->readyToDraw())) { |
248 GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc); | 259 GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc); |
249 if (NULL != texture) { | 260 if (NULL != texture) { |
250 return texture; | 261 return texture; |
251 } | 262 } |
252 } | 263 } |
253 #endif // SK_IGNORE_ETC1_SUPPORT | 264 #endif // SK_IGNORE_ETC1_SUPPORT |
254 | 265 |
255 SkAutoLockPixels alp(*bitmap); | 266 SkAutoLockPixels alp(*bitmap); |
256 if (!bitmap->readyToDraw()) { | 267 if (!bitmap->readyToDraw()) { |
257 return NULL; | 268 return NULL; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 copy.setShader(NULL); | 521 copy.setShader(NULL); |
511 // modulate the paint alpha by the shader's solid color alpha | 522 // modulate the paint alpha by the shader's solid color alpha |
512 U8CPU newA = SkMulDiv255Round(SkColorGetA(color), copy.getAlpha()); | 523 U8CPU newA = SkMulDiv255Round(SkColorGetA(color), copy.getAlpha()); |
513 copy.setColor(SkColorSetA(color, newA)); | 524 copy.setColor(SkColorSetA(color, newA)); |
514 SkPaint2GrPaintNoShader(context, copy, false, constantColor, grPaint
); | 525 SkPaint2GrPaintNoShader(context, copy, false, constantColor, grPaint
); |
515 } else { | 526 } else { |
516 SkPaint2GrPaintNoShader(context, skPaint, false, constantColor, grPa
int); | 527 SkPaint2GrPaintNoShader(context, skPaint, false, constantColor, grPa
int); |
517 } | 528 } |
518 } | 529 } |
519 } | 530 } |
OLD | NEW |