aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrPaint.h
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-08 13:26:43 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-08 13:26:43 -0800
commit8d95ffa497091d0c9c7cda099684c7bca6714a17 (patch)
treeb47fb9fba90f1c9c945db4c9d0fcd73802c8773e /include/gpu/GrPaint.h
parent4ccf0b94054a4c16641c027edb4b0cfd0daddb65 (diff)
Revert of Make all blending up to GrOptDrawState be handled by the xp/xp factory. (patchset #7 id:140001 of https://codereview.chromium.org/759713002/)
Reason for revert: break many gm's Original issue's description: > 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 TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/766653008
Diffstat (limited to 'include/gpu/GrPaint.h')
-rw-r--r--include/gpu/GrPaint.h32
1 files changed, 22 insertions, 10 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 49b95b8449..f31830bb2b 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -13,7 +13,6 @@
#include "GrColor.h"
#include "GrFragmentStage.h"
#include "GrXferProcessor.h"
-#include "effects/GrPorterDuffXferProcessor.h"
#include "SkXfermode.h"
@@ -52,6 +51,17 @@ 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; }
@@ -74,14 +84,6 @@ 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.
*/
@@ -119,6 +121,8 @@ 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;
@@ -136,6 +140,7 @@ public:
* Resets the paint to the defaults.
*/
void reset() {
+ this->resetBlend();
this->resetOptions();
this->resetColor();
this->resetStages();
@@ -206,11 +211,18 @@ 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;
@@ -220,7 +232,7 @@ private:
fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
}
- void resetStages();
+ void resetStages();
};
#endif