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

Unified Diff: src/gpu/GrDrawState.h

Issue 866573002: XPFactory lazily initializie in drawstate / GrPaint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 11 months 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 | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index c02429f9658f7aa624923058bf2b44ff4a260373..45fc574bde78c8b5a511d8223f5133f16efe9b6d 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -30,11 +30,7 @@ class GrTexture;
class GrDrawState {
public:
- GrDrawState() {
- SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
- this->reset();
- }
-
+ GrDrawState();
/**
* Copies another draw state.
**/
@@ -46,11 +42,6 @@ public:
virtual ~GrDrawState();
/**
- * Resets to the default state. GrProcessors will be removed from all stages.
- */
- void reset() { this->onReset(); }
-
- /**
* Initializes the GrDrawState based on a GrPaint, view matrix and render target. Note that
* GrDrawState encompasses more than GrPaint. Aspects of GrDrawState that have no GrPaint
* equivalents are set to default values with the exception of vertex attribute state which
@@ -102,7 +93,12 @@ public:
int numCoverageStages() const { return fCoverageStages.count(); }
int numFragmentStages() const { return this->numColorStages() + this->numCoverageStages(); }
- const GrXPFactory* getXPFactory() const { return fXPFactory.get(); }
+ const GrXPFactory* getXPFactory() const {
+ if (!fXPFactory) {
+ fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode));
+ }
+ return fXPFactory.get();
+ }
const GrFragmentStage& getColorStage(int idx) const { return fColorStages[idx]; }
const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageStages[idx]; }
@@ -404,8 +400,6 @@ public:
GrDrawState& operator= (const GrDrawState& that);
private:
- bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const;
-
const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
this->calcColorInvariantOutput(pp);
return fColorProcInfo;
@@ -440,8 +434,6 @@ private:
*/
void calcCoverageInvariantOutput(GrColor) const;
- void onReset();
-
// Some of the auto restore objects assume that no effects are removed during their lifetime.
// This is used to assert that this condition holds.
SkDEBUGCODE(int fBlockEffectRemovalCnt;)
@@ -452,7 +444,7 @@ private:
uint32_t fFlagBits;
GrStencilSettings fStencilSettings;
DrawFace fDrawFace;
- SkAutoTUnref<const GrXPFactory> fXPFactory;
+ mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
FragmentStageArray fColorStages;
FragmentStageArray fCoverageStages;
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698