| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrPaint.h" | 9 #include "GrPaint.h" |
| 10 | 10 |
| 11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
| 12 #include "effects/GrSimpleTextureEffect.h" | 12 #include "effects/GrSimpleTextureEffect.h" |
| 13 | 13 |
| 14 void GrPaint::addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix)
{ | 14 void GrPaint::addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix)
{ |
| 15 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); | 15 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(
); |
| 16 this->addColorEffect(effect)->unref(); | |
| 17 } | 16 } |
| 18 | 17 |
| 19 void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matri
x) { | 18 void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matri
x) { |
| 20 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); | 19 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); |
| 21 this->addCoverageEffect(effect)->unref(); | |
| 22 } | 20 } |
| 23 | 21 |
| 24 void GrPaint::addColorTextureEffect(GrTexture* texture, | 22 void GrPaint::addColorTextureEffect(GrTexture* texture, |
| 25 const SkMatrix& matrix, | 23 const SkMatrix& matrix, |
| 26 const GrTextureParams& params) { | 24 const GrTextureParams& params) { |
| 27 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params)
; | 25 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix, params))
->unref(); |
| 28 this->addColorEffect(effect)->unref(); | |
| 29 } | 26 } |
| 30 | 27 |
| 31 void GrPaint::addCoverageTextureEffect(GrTexture* texture, | 28 void GrPaint::addCoverageTextureEffect(GrTexture* texture, |
| 32 const SkMatrix& matrix, | 29 const SkMatrix& matrix, |
| 33 const GrTextureParams& params) { | 30 const GrTextureParams& params) { |
| 34 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params)
; | 31 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix, param
s))->unref(); |
| 35 this->addCoverageEffect(effect)->unref(); | |
| 36 } | 32 } |
| 37 | 33 |
| 38 bool GrPaint::isOpaque() const { | 34 bool GrPaint::isOpaque() const { |
| 39 return this->getOpaqueAndKnownColor(NULL, NULL); | 35 return this->getOpaqueAndKnownColor(NULL, NULL); |
| 40 } | 36 } |
| 41 | 37 |
| 42 bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const { | 38 bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const { |
| 43 GrColor tempColor; | 39 GrColor tempColor; |
| 44 uint32_t colorComps; | 40 uint32_t colorComps; |
| 45 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) { | 41 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 case kIConstA_GrBlendCoeff: | 110 case kIConstA_GrBlendCoeff: |
| 115 *solidColorKnownComponents = 0; | 111 *solidColorKnownComponents = 0; |
| 116 break; | 112 break; |
| 117 } | 113 } |
| 118 } else { | 114 } else { |
| 119 solidColorKnownComponents = 0; | 115 solidColorKnownComponents = 0; |
| 120 } | 116 } |
| 121 } | 117 } |
| 122 return opaque; | 118 return opaque; |
| 123 } | 119 } |
| OLD | NEW |