aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrPaint.h
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-09 11:15:43 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-09 11:15:44 -0800
commit9513143efa734bef0c1a0c7f945022572dbc8518 (patch)
tree767babf49d28d878f8eb29900115bfc54dd54917 /include/gpu/GrPaint.h
parent9f876a37d8b80ef04ccbc7755cf4572aecc33981 (diff)
Make all blending up to GrOptDrawState be handled by the xp/xp factory.
In this cl the blending information is extracted for the xp and stored in the ODS which is then used as it currently is. In the follow up cl, an XP backend will be added and at that point all blending work will take place inside XP's. BUG=skia: Committed: https://skia.googlesource.com/skia/+/7c66342a399b529634bed0fabfaa562db2c0dbd4 Review URL: https://codereview.chromium.org/759713002
Diffstat (limited to 'include/gpu/GrPaint.h')
-rw-r--r--include/gpu/GrPaint.h32
1 files changed, 10 insertions, 22 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index f31830bb2b..49b95b8449 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -13,6 +13,7 @@
#include "GrColor.h"
#include "GrFragmentStage.h"
#include "GrXferProcessor.h"
+#include "effects/GrPorterDuffXferProcessor.h"
#include "SkXfermode.h"
@@ -51,17 +52,6 @@ public:
~GrPaint() {}
/**
- * Sets the blending coefficients to use to blend the final primitive color with the
- * destination color. Defaults to kOne for src and kZero for dst (i.e. src mode).
- */
- void setBlendFunc(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) {
- fSrcBlendCoeff = srcCoeff;
- fDstBlendCoeff = dstCoeff;
- }
- GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlendCoeff; }
- GrBlendCoeff getDstBlendCoeff() const { return fDstBlendCoeff; }
-
- /**
* The initial color of the drawn primitive. Defaults to solid white.
*/
void setColor(GrColor color) { fColor = color; }
@@ -84,6 +74,14 @@ public:
return xpFactory;
}
+ void setPorterDuffXPFactory(SkXfermode::Mode mode) {
+ fXPFactory.reset(GrPorterDuffXPFactory::Create(mode));
+ }
+
+ void setPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) {
+ fXPFactory.reset(GrPorterDuffXPFactory::Create(src, dst));
+ }
+
/**
* Appends an additional color processor to the color computation.
*/
@@ -121,8 +119,6 @@ public:
const GrFragmentStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
GrPaint& operator=(const GrPaint& paint) {
- fSrcBlendCoeff = paint.fSrcBlendCoeff;
- fDstBlendCoeff = paint.fDstBlendCoeff;
fAntiAlias = paint.fAntiAlias;
fDither = paint.fDither;
@@ -140,7 +136,6 @@ public:
* Resets the paint to the defaults.
*/
void reset() {
- this->resetBlend();
this->resetOptions();
this->resetColor();
this->resetStages();
@@ -211,18 +206,11 @@ private:
SkSTArray<4, GrFragmentStage> fColorStages;
SkSTArray<2, GrFragmentStage> fCoverageStages;
- GrBlendCoeff fSrcBlendCoeff;
- GrBlendCoeff fDstBlendCoeff;
bool fAntiAlias;
bool fDither;
GrColor fColor;
- void resetBlend() {
- fSrcBlendCoeff = kOne_GrBlendCoeff;
- fDstBlendCoeff = kZero_GrBlendCoeff;
- }
-
void resetOptions() {
fAntiAlias = false;
fDither = false;
@@ -232,7 +220,7 @@ private:
fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
}
- void resetStages();
+ void resetStages();
};
#endif