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 "GrProcOptInfo.h" | 11 #include "GrProcOptInfo.h" |
12 #include "effects/GrCoverageSetOpXP.h" | 12 #include "effects/GrCoverageSetOpXP.h" |
13 #include "effects/GrPorterDuffXferProcessor.h" | 13 #include "effects/GrPorterDuffXferProcessor.h" |
14 #include "effects/GrSimpleTextureEffect.h" | 14 #include "effects/GrSimpleTextureEffect.h" |
15 | 15 |
16 GrPaint::GrPaint() | 16 GrPaint::GrPaint() |
17 : fAntiAlias(false) | 17 : fAntiAlias(false) |
18 , fColor(GrColor_WHITE) {} | 18 , fColor(GrColor_WHITE) {} |
19 | 19 |
20 void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
ge) { | 20 void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
ge) { |
21 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage))
; | 21 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage))
; |
22 } | 22 } |
23 | 23 |
24 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { | 24 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x, GrRenderTarget* dst) { |
25 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matri
x))->unref(); | 25 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, |
| 26 matrix, kLocal
_GrCoordSet, dst))->unref(); |
26 } | 27 } |
27 | 28 |
28 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { | 29 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix, GrRenderTarget* dst) { |
29 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, ma
trix))->unref(); | 30 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, |
| 31 matrix, kLo
cal_GrCoordSet, dst))->unref(); |
30 } | 32 } |
31 | 33 |
32 void GrPaint::addColorTextureProcessor(GrTexture* texture, | 34 void GrPaint::addColorTextureProcessor(GrTexture* texture, |
33 const SkMatrix& matrix, | 35 const SkMatrix& matrix, |
34 const GrTextureParams& params) { | 36 const GrTextureParams& params, GrRenderTa
rget* dst) { |
35 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, | 37 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, |
36 matrix, params
))->unref(); | 38 matrix, params
, kLocal_GrCoordSet, dst))->unref(); |
37 } | 39 } |
38 | 40 |
39 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, | 41 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, |
40 const SkMatrix& matrix, | 42 const SkMatrix& matrix, |
41 const GrTextureParams& params) { | 43 const GrTextureParams& params, GrRende
rTarget* dst) { |
42 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, | 44 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, |
43 matrix, par
ams))->unref(); | 45 matrix, par
ams, kLocal_GrCoordSet, dst))->unref(); |
44 } | 46 } |
45 | 47 |
46 bool GrPaint::isConstantBlendedColor(GrColor* color) const { | 48 bool GrPaint::isConstantBlendedColor(GrColor* color) const { |
47 GrProcOptInfo colorProcInfo; | 49 GrProcOptInfo colorProcInfo; |
48 colorProcInfo.calcWithInitialValues(fColorFragmentProcessors.begin(), | 50 colorProcInfo.calcWithInitialValues(fColorFragmentProcessors.begin(), |
49 this->numColorFragmentProcessors(), fCol
or, | 51 this->numColorFragmentProcessors(), fCol
or, |
50 kRGBA_GrColorComponentFlags, false); | 52 kRGBA_GrColorComponentFlags, false); |
51 | 53 |
52 GrXPFactory::InvariantBlendedColor blendedColor; | 54 GrXPFactory::InvariantBlendedColor blendedColor; |
53 fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor); | 55 fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor); |
54 | 56 |
55 if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) { | 57 if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) { |
56 *color = blendedColor.fKnownColor; | 58 *color = blendedColor.fKnownColor; |
57 return true; | 59 return true; |
58 } | 60 } |
59 return false; | 61 return false; |
60 } | 62 } |
OLD | NEW |