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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { | 337 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { |
338 SkASSERT(NULL != texture->getContext()); | 338 SkASSERT(NULL != texture->getContext()); |
339 | 339 |
340 texture->getContext()->unlockScratchTexture(texture); | 340 texture->getContext()->unlockScratchTexture(texture); |
341 texture->unref(); | 341 texture->unref(); |
342 } | 342 } |
343 | 343 |
344 /////////////////////////////////////////////////////////////////////////////// | 344 /////////////////////////////////////////////////////////////////////////////// |
345 | 345 |
| 346 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG |
346 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) { | 347 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) { |
347 switch (config) { | 348 switch (config) { |
348 case SkBitmap::kA8_Config: | 349 case SkBitmap::kA8_Config: |
349 return kAlpha_8_GrPixelConfig; | 350 return kAlpha_8_GrPixelConfig; |
350 case SkBitmap::kIndex8_Config: | 351 case SkBitmap::kIndex8_Config: |
351 return kIndex_8_GrPixelConfig; | 352 return kIndex_8_GrPixelConfig; |
352 case SkBitmap::kRGB_565_Config: | 353 case SkBitmap::kRGB_565_Config: |
353 return kRGB_565_GrPixelConfig; | 354 return kRGB_565_GrPixelConfig; |
354 case SkBitmap::kARGB_4444_Config: | 355 case SkBitmap::kARGB_4444_Config: |
355 return kRGBA_4444_GrPixelConfig; | 356 return kRGBA_4444_GrPixelConfig; |
356 case SkBitmap::kARGB_8888_Config: | 357 case SkBitmap::kARGB_8888_Config: |
357 return kSkia8888_GrPixelConfig; | 358 return kSkia8888_GrPixelConfig; |
358 default: | 359 default: |
359 // kNo_Config, kA1_Config missing | 360 // kNo_Config, kA1_Config missing |
360 return kUnknown_GrPixelConfig; | 361 return kUnknown_GrPixelConfig; |
361 } | 362 } |
362 } | 363 } |
| 364 #endif |
363 | 365 |
364 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass | 366 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass |
365 // alpha info, that will be considered. | 367 // alpha info, that will be considered. |
366 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) { | 368 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) { |
367 switch (ct) { | 369 switch (ct) { |
368 case kUnknown_SkColorType: | 370 case kUnknown_SkColorType: |
369 return kUnknown_GrPixelConfig; | 371 return kUnknown_GrPixelConfig; |
370 case kAlpha_8_SkColorType: | 372 case kAlpha_8_SkColorType: |
371 return kAlpha_8_GrPixelConfig; | 373 return kAlpha_8_GrPixelConfig; |
372 case kRGB_565_SkColorType: | 374 case kRGB_565_SkColorType: |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 GrEffectRef* grEffect = NULL; | 504 GrEffectRef* grEffect = NULL; |
503 if (shader->asNewEffect(context, skPaint, NULL, &grColor, &grEffect) && NULL
!= grEffect) { | 505 if (shader->asNewEffect(context, skPaint, NULL, &grColor, &grEffect) && NULL
!= grEffect) { |
504 SkAutoTUnref<GrEffectRef> effect(grEffect); | 506 SkAutoTUnref<GrEffectRef> effect(grEffect); |
505 grPaint->addColorEffect(effect); | 507 grPaint->addColorEffect(effect); |
506 constantColor = false; | 508 constantColor = false; |
507 } | 509 } |
508 // The grcolor is automatically set when calling asneweffect. | 510 // The grcolor is automatically set when calling asneweffect. |
509 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 511 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
510 SkPaint2GrPaintNoShader(context, skPaint, grColor, constantColor, grPaint); | 512 SkPaint2GrPaintNoShader(context, skPaint, grColor, constantColor, grPaint); |
511 } | 513 } |
OLD | NEW |