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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { | 422 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) { |
423 SkASSERT(NULL != texture->getContext()); | 423 SkASSERT(NULL != texture->getContext()); |
424 | 424 |
425 texture->getContext()->unlockScratchTexture(texture); | 425 texture->getContext()->unlockScratchTexture(texture); |
426 texture->unref(); | 426 texture->unref(); |
427 } | 427 } |
428 | 428 |
429 /////////////////////////////////////////////////////////////////////////////// | 429 /////////////////////////////////////////////////////////////////////////////// |
430 | 430 |
431 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG | |
432 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) { | |
433 switch (config) { | |
434 case SkBitmap::kA8_Config: | |
435 return kAlpha_8_GrPixelConfig; | |
436 case SkBitmap::kIndex8_Config: | |
437 return kIndex_8_GrPixelConfig; | |
438 case SkBitmap::kRGB_565_Config: | |
439 return kRGB_565_GrPixelConfig; | |
440 case SkBitmap::kARGB_4444_Config: | |
441 return kRGBA_4444_GrPixelConfig; | |
442 case SkBitmap::kARGB_8888_Config: | |
443 return kSkia8888_GrPixelConfig; | |
444 default: | |
445 // kNo_Config, kA1_Config missing | |
446 return kUnknown_GrPixelConfig; | |
447 } | |
448 } | |
449 #endif | |
450 | |
451 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass | 431 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass |
452 // alpha info, that will be considered. | 432 // alpha info, that will be considered. |
453 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) { | 433 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) { |
454 switch (ct) { | 434 switch (ct) { |
455 case kUnknown_SkColorType: | 435 case kUnknown_SkColorType: |
456 return kUnknown_GrPixelConfig; | 436 return kUnknown_GrPixelConfig; |
457 case kAlpha_8_SkColorType: | 437 case kAlpha_8_SkColorType: |
458 return kAlpha_8_GrPixelConfig; | 438 return kAlpha_8_GrPixelConfig; |
459 case kRGB_565_SkColorType: | 439 case kRGB_565_SkColorType: |
460 return kRGB_565_GrPixelConfig; | 440 return kRGB_565_GrPixelConfig; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) &&
NULL != effect) { | 598 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) &&
NULL != effect) { |
619 grPaint->addColorEffect(effect)->unref(); | 599 grPaint->addColorEffect(effect)->unref(); |
620 constantColor = false; | 600 constantColor = false; |
621 } | 601 } |
622 } | 602 } |
623 | 603 |
624 // The grcolor is automatically set when calling asneweffect. | 604 // The grcolor is automatically set when calling asneweffect. |
625 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 605 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
626 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 606 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
627 } | 607 } |
OLD | NEW |