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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 bitmap->height(), desc.fConfig, | 216 bitmap->height(), desc.fConfig, |
217 storage.get()); | 217 storage.get()); |
218 return result; | 218 return result; |
219 } | 219 } |
220 } else { | 220 } else { |
221 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType); | 221 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType); |
222 // now bitmap points to our temp, which has been promoted to 32bits | 222 // now bitmap points to our temp, which has been promoted to 32bits |
223 bitmap = &tmpBitmap; | 223 bitmap = &tmpBitmap; |
224 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info()); | 224 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info()); |
225 } | 225 } |
| 226 } |
226 | 227 |
227 // Is this an ETC1 encoded texture? | 228 // Is this an ETC1 encoded texture? |
228 #if SK_SUPPORT_ETC1 | 229 #if SK_SUPPORT_ETC1 |
229 } else if (cache && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelC
onfig)) { | 230 else if (cache && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelCon
fig)) { |
230 GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc); | 231 GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc); |
231 if (NULL != texture) { | 232 if (NULL != texture) { |
232 return texture; | 233 return texture; |
233 } | 234 } |
234 } | 235 } |
235 #endif // SK_SUPPORT_ETC1 | 236 #endif // SK_SUPPORT_ETC1 |
236 | 237 |
237 SkAutoLockPixels alp(*bitmap); | 238 SkAutoLockPixels alp(*bitmap); |
238 if (!bitmap->readyToDraw()) { | 239 if (!bitmap->readyToDraw()) { |
239 return NULL; | 240 return NULL; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 copy.setShader(NULL); | 493 copy.setShader(NULL); |
493 // modulate the paint alpha by the shader's solid color alpha | 494 // modulate the paint alpha by the shader's solid color alpha |
494 U8CPU newA = SkMulDiv255Round(SkColorGetA(color), copy.getAlpha()); | 495 U8CPU newA = SkMulDiv255Round(SkColorGetA(color), copy.getAlpha()); |
495 copy.setColor(SkColorSetA(color, newA)); | 496 copy.setColor(SkColorSetA(color, newA)); |
496 SkPaint2GrPaintNoShader(context, copy, false, constantColor, grPaint
); | 497 SkPaint2GrPaintNoShader(context, copy, false, constantColor, grPaint
); |
497 } else { | 498 } else { |
498 SkPaint2GrPaintNoShader(context, skPaint, false, constantColor, grPa
int); | 499 SkPaint2GrPaintNoShader(context, skPaint, false, constantColor, grPa
int); |
499 } | 500 } |
500 } | 501 } |
501 } | 502 } |
OLD | NEW |