| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 | 9 |
| 10 #include "effects/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 grPaint->setAntiAlias(skPaint.isAntiAlias()); | 494 grPaint->setAntiAlias(skPaint.isAntiAlias()); |
| 495 | 495 |
| 496 SkXfermode::Coeff sm; | 496 SkXfermode::Coeff sm; |
| 497 SkXfermode::Coeff dm; | 497 SkXfermode::Coeff dm; |
| 498 | 498 |
| 499 SkXfermode* mode = skPaint.getXfermode(); | 499 SkXfermode* mode = skPaint.getXfermode(); |
| 500 GrEffectRef* xferEffect = NULL; | 500 GrEffectRef* xferEffect = NULL; |
| 501 if (SkXfermode::AsNewEffectOrCoeff(mode, dev->context(), &xferEffect, &sm, &
dm)) { | 501 if (SkXfermode::AsNewEffectOrCoeff(mode, dev->context(), &xferEffect, &sm, &
dm)) { |
| 502 if (NULL != xferEffect) { | 502 if (NULL != xferEffect) { |
| 503 grPaint->colorStage(kXfermodeEffectIdx)->setEffect(xferEffect)->unre
f(); | 503 grPaint->colorStage(kXfermodeEffectIdx)->setEffect(xferEffect)->unre
f(); |
| 504 // This may not be the right place to have this logic but we set the
GPU blend to | |
| 505 // src-over so that fractional coverage will be accounted for correc
tly. | |
| 506 sm = SkXfermode::kOne_Coeff; | 504 sm = SkXfermode::kOne_Coeff; |
| 507 dm = SkXfermode::kISA_Coeff; | 505 dm = SkXfermode::kZero_Coeff; |
| 508 } | 506 } |
| 509 } else { | 507 } else { |
| 510 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) | 508 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) |
| 511 #if 0 | 509 #if 0 |
| 512 return false; | 510 return false; |
| 513 #else | 511 #else |
| 514 // Fall back to src-over | 512 // Fall back to src-over |
| 515 sm = SkXfermode::kOne_Coeff; | 513 sm = SkXfermode::kOne_Coeff; |
| 516 dm = SkXfermode::kISA_Coeff; | 514 dm = SkXfermode::kISA_Coeff; |
| 517 #endif | 515 #endif |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 GrTexture* texture, | 1824 GrTexture* texture, |
| 1827 bool needClear) | 1825 bool needClear) |
| 1828 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { | 1826 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1829 | 1827 |
| 1830 GrAssert(texture && texture->asRenderTarget()); | 1828 GrAssert(texture && texture->asRenderTarget()); |
| 1831 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1829 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1832 // cache. We pass true for the third argument so that it will get unlocked. | 1830 // cache. We pass true for the third argument so that it will get unlocked. |
| 1833 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1831 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1834 fNeedClear = needClear; | 1832 fNeedClear = needClear; |
| 1835 } | 1833 } |
| OLD | NEW |