| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 bool constantColor, | 477 bool constantColor, |
| 478 GrPaint* grPaint) { | 478 GrPaint* grPaint) { |
| 479 | 479 |
| 480 grPaint->setDither(skPaint.isDither()); | 480 grPaint->setDither(skPaint.isDither()); |
| 481 grPaint->setAntiAlias(skPaint.isAntiAlias()); | 481 grPaint->setAntiAlias(skPaint.isAntiAlias()); |
| 482 | 482 |
| 483 SkXfermode::Coeff sm = SkXfermode::kOne_Coeff; | 483 SkXfermode::Coeff sm = SkXfermode::kOne_Coeff; |
| 484 SkXfermode::Coeff dm = SkXfermode::kISA_Coeff; | 484 SkXfermode::Coeff dm = SkXfermode::kISA_Coeff; |
| 485 | 485 |
| 486 SkXfermode* mode = skPaint.getXfermode(); | 486 SkXfermode* mode = skPaint.getXfermode(); |
| 487 if (mode) { | 487 GrEffectRef* xferEffect; |
| 488 if (!mode->asCoeff(&sm, &dm)) { | 488 if (SkXfermode::AsNewEffect(mode, dev->context(), &xferEffect, &sm, &dm)) { |
| 489 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) | 489 // We're not ready for xfermode effects yet |
| 490 GrAssert(NULL == xferEffect); |
| 491 } else { |
| 492 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) |
| 490 #if 0 | 493 #if 0 |
| 491 return false; | 494 return false; |
| 492 #endif | 495 #endif |
| 493 } | |
| 494 } | 496 } |
| 495 grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); | 497 grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); |
| 496 | 498 |
| 497 if (justAlpha) { | 499 if (justAlpha) { |
| 498 uint8_t alpha = skPaint.getAlpha(); | 500 uint8_t alpha = skPaint.getAlpha(); |
| 499 grPaint->setColor(GrColorPackRGBA(alpha, alpha, alpha, alpha)); | 501 grPaint->setColor(GrColorPackRGBA(alpha, alpha, alpha, alpha)); |
| 500 // justAlpha is currently set to true only if there is a texture, | 502 // justAlpha is currently set to true only if there is a texture, |
| 501 // so constantColor should not also be true. | 503 // so constantColor should not also be true. |
| 502 GrAssert(!constantColor); | 504 GrAssert(!constantColor); |
| 503 } else { | 505 } else { |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 GrTexture* texture, | 1836 GrTexture* texture, |
| 1835 bool needClear) | 1837 bool needClear) |
| 1836 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { | 1838 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1837 | 1839 |
| 1838 GrAssert(texture && texture->asRenderTarget()); | 1840 GrAssert(texture && texture->asRenderTarget()); |
| 1839 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1841 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1840 // cache. We pass true for the third argument so that it will get unlocked. | 1842 // cache. We pass true for the third argument so that it will get unlocked. |
| 1841 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1843 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1842 fNeedClear = needClear; | 1844 fNeedClear = needClear; |
| 1843 } | 1845 } |
| OLD | NEW |