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 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(
); | 15 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); |
| 16 this->addColorEffect(effect)->unref(); |
16 } | 17 } |
17 | 18 |
18 void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matri
x) { | 19 void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matri
x) { |
19 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); | 20 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); |
| 21 this->addCoverageEffect(effect)->unref(); |
20 } | 22 } |
21 | 23 |
22 void GrPaint::addColorTextureEffect(GrTexture* texture, | 24 void GrPaint::addColorTextureEffect(GrTexture* texture, |
23 const SkMatrix& matrix, | 25 const SkMatrix& matrix, |
24 const GrTextureParams& params) { | 26 const GrTextureParams& params) { |
25 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix, params))
->unref(); | 27 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params)
; |
| 28 this->addColorEffect(effect)->unref(); |
26 } | 29 } |
27 | 30 |
28 void GrPaint::addCoverageTextureEffect(GrTexture* texture, | 31 void GrPaint::addCoverageTextureEffect(GrTexture* texture, |
29 const SkMatrix& matrix, | 32 const SkMatrix& matrix, |
30 const GrTextureParams& params) { | 33 const GrTextureParams& params) { |
31 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix, param
s))->unref(); | 34 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params)
; |
| 35 this->addCoverageEffect(effect)->unref(); |
32 } | 36 } |
33 | 37 |
34 bool GrPaint::isOpaque() const { | 38 bool GrPaint::isOpaque() const { |
35 return this->getOpaqueAndKnownColor(NULL, NULL); | 39 return this->getOpaqueAndKnownColor(NULL, NULL); |
36 } | 40 } |
37 | 41 |
38 bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const { | 42 bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const { |
39 GrColor tempColor; | 43 GrColor tempColor; |
40 uint32_t colorComps; | 44 uint32_t colorComps; |
41 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) { | 45 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 case kIConstA_GrBlendCoeff: | 114 case kIConstA_GrBlendCoeff: |
111 *solidColorKnownComponents = 0; | 115 *solidColorKnownComponents = 0; |
112 break; | 116 break; |
113 } | 117 } |
114 } else { | 118 } else { |
115 solidColorKnownComponents = 0; | 119 solidColorKnownComponents = 0; |
116 } | 120 } |
117 } | 121 } |
118 return opaque; | 122 return opaque; |
119 } | 123 } |
OLD | NEW |