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

Unified Diff: include/gpu/GrPaint.h

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update gyp Created 6 years, 1 month 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
Index: include/gpu/GrPaint.h
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 6a40a71ffcec425d4071e614a5397bda30796bea..04c64b8d589129d9aa92326c9577a52dda9801e5 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -12,6 +12,7 @@
#include "GrColor.h"
#include "GrFragmentStage.h"
+#include "GrXferProcessor.h"
#include "SkXfermode.h"
@@ -78,6 +79,12 @@ public:
void setDither(bool dither) { fDither = dither; }
bool isDither() const { return fDither; }
+ const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
+ SkASSERT(xpFactory);
bsalomon 2014/11/26 21:02:44 This assert is done in SkRef().
egdaniel 2014/12/01 18:18:24 removed
+ fXPFactory.reset(SkRef(xpFactory));
+ return xpFactory;
+ }
+
/**
* Appends an additional color processor to the color computation.
*/
@@ -109,6 +116,9 @@ public:
int numCoverageStages() const { return fCoverageStages.count(); }
int numTotalStages() const { return this->numColorStages() + this->numCoverageStages(); }
+ bool hasXPFactory() const { return SkToBool(fXPFactory.get()); }
+ const GrXPFactory* getXPFactory() const { return fXPFactory.get(); }
+
const GrFragmentStage& getColorStage(int s) const { return fColorStages[s]; }
const GrFragmentStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
@@ -123,6 +133,9 @@ public:
fColorStages = paint.fColorStages;
fCoverageStages = paint.fCoverageStages;
+ SkASSERT(paint.hasXPFactory());
bsalomon 2014/11/26 21:02:44 Why this assert?
egdaniel 2014/12/01 18:18:24 gone
+ fXPFactory.reset(SkRef(paint.getXPFactory()));
+
return *this;
}
@@ -197,15 +210,16 @@ private:
friend class GrContext; // To access above two functions
friend class GrStencilAndCoverTextContext; // To access above two functions
- SkSTArray<4, GrFragmentStage> fColorStages;
- SkSTArray<2, GrFragmentStage> fCoverageStages;
+ SkAutoTUnref<const GrXPFactory> fXPFactory;
+ SkSTArray<4, GrFragmentStage> fColorStages;
+ SkSTArray<2, GrFragmentStage> fCoverageStages;
- GrBlendCoeff fSrcBlendCoeff;
- GrBlendCoeff fDstBlendCoeff;
- bool fAntiAlias;
- bool fDither;
+ GrBlendCoeff fSrcBlendCoeff;
+ GrBlendCoeff fDstBlendCoeff;
+ bool fAntiAlias;
+ bool fDither;
- GrColor fColor;
+ GrColor fColor;
void resetBlend() {
fSrcBlendCoeff = kOne_GrBlendCoeff;
@@ -221,10 +235,7 @@ private:
fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
}
- void resetStages() {
- fColorStages.reset();
- fCoverageStages.reset();
- }
+ void resetStages();
};
#endif

Powered by Google App Engine
This is Rietveld 408576698