Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: include/gpu/GrPaint.h

Issue 766653008: Revert of Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkXfermode.h ('k') | include/gpu/GrXferProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrPaint.h
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 49b95b8449357e4872c78ee158549cca05363a2a..f31830bb2bfa6d58361d9edfaef28f542d7dd7d9 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 @@
~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; }
@@ -72,14 +82,6 @@
const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
fXPFactory.reset(SkRef(xpFactory));
return xpFactory;
- }
-
- void setPorterDuffXPFactory(SkXfermode::Mode mode) {
- fXPFactory.reset(GrPorterDuffXPFactory::Create(mode));
- }
-
- void setPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) {
- fXPFactory.reset(GrPorterDuffXPFactory::Create(src, dst));
}
/**
@@ -119,6 +121,8 @@
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 @@
* Resets the paint to the defaults.
*/
void reset() {
+ this->resetBlend();
this->resetOptions();
this->resetColor();
this->resetStages();
@@ -206,10 +211,17 @@
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;
@@ -220,7 +232,7 @@
fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
}
- void resetStages();
+ void resetStages();
};
#endif
« no previous file with comments | « include/core/SkXfermode.h ('k') | include/gpu/GrXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698