aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawState.h
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-01-22 07:11:44 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-22 07:11:45 -0800
commit2fdeda04988867625bb9bc2f7f6037406a0a98ec (patch)
tree25e6ec239fcd55ecffd649cff61720622ece329c /src/gpu/GrDrawState.h
parentdcfb7cf336cafffd8d149c908b615e1deaa3a49b (diff)
XPFactory lazily initializie in drawstate / GrPaint
Diffstat (limited to 'src/gpu/GrDrawState.h')
-rw-r--r--src/gpu/GrDrawState.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index c02429f965..45fc574bde 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;