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

Unified Diff: src/gpu/GrDrawState.cpp

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/GrDrawState.h ('k') | src/gpu/GrPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 4ec39e7005a327d5470fafebfd40c61efa209f6d..db703935ca7105515c5367c4eccc188435db8d8f 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -14,36 +14,18 @@
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
-bool GrDrawState::isEqual(const GrDrawState& that, bool explicitLocalCoords) const {
- if (this->getRenderTarget() != that.getRenderTarget() ||
- this->fColorStages.count() != that.fColorStages.count() ||
- this->fCoverageStages.count() != that.fCoverageStages.count() ||
- this->fFlagBits != that.fFlagBits ||
- this->fStencilSettings != that.fStencilSettings ||
- this->fDrawFace != that.fDrawFace) {
- return false;
- }
-
- if (!this->getXPFactory()->isEqual(*that.getXPFactory())) {
- return false;
- }
-
- for (int i = 0; i < this->numColorStages(); i++) {
- if (this->getColorStage(i) != that.getColorStage(i)) {
- return false;
- }
- }
- for (int i = 0; i < this->numCoverageStages(); i++) {
- if (this->getCoverageStage(i) != that.getCoverageStage(i)) {
- return false;
- }
- }
-
- return true;
+GrDrawState::GrDrawState()
+ : fFlagBits(0x0)
+ , fDrawFace(kBoth_DrawFace)
+ , fColorProcInfoValid(false)
+ , fCoverageProcInfoValid(false)
+ , fColorCache(GrColor_ILLEGAL)
+ , fCoverageCache(GrColor_ILLEGAL)
+ , fColorPrimProc(NULL)
+ , fCoveragePrimProc(NULL) {
+ SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
}
-//////////////////////////////////////////////////////////////////////////////
-
GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get()));
fFlagBits = that.fFlagBits;
@@ -68,28 +50,6 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
return *this;
}
-void GrDrawState::onReset() {
- SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages());
- fRenderTarget.reset(NULL);
-
- fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode));
- fColorStages.reset();
- fCoverageStages.reset();
-
- fFlagBits = 0x0;
- fStencilSettings.setDisabled();
- fDrawFace = kBoth_DrawFace;
-
- fColorProcInfoValid = false;
- fCoverageProcInfoValid = false;
-
- fColorCache = GrColor_ILLEGAL;
- fCoverageCache = GrColor_ILLEGAL;
-
- fColorPrimProc = NULL;
- fCoveragePrimProc = NULL;
-}
-
void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages());
@@ -142,13 +102,13 @@ bool GrDrawState::canUseFracCoveragePrimProc(GrColor color, const GrDrawTargetCa
// TODO we want to cache the result of this call, but we can probably clean up the interface
// so we don't have to pass in a seemingly known coverage
this->calcCoverageInvariantOutput(GrColor_WHITE);
- return fXPFactory->canApplyCoverage(fColorProcInfo, fCoverageProcInfo);
+ return this->getXPFactory()->canApplyCoverage(fColorProcInfo, fCoverageProcInfo);
}
//////////////////////////////////////////////////////////////////////////////s
bool GrDrawState::willEffectReadDstColor() const {
- return fXPFactory->willReadDst();
+ return this->getXPFactory()->willReadDst();
}
void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
@@ -179,7 +139,7 @@ void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
// Some blend modes allow folding a fractional coverage value into the color's alpha channel, while
// others will blend incorrectly.
bool GrDrawState::canTweakAlphaForCoverage() const {
- return fXPFactory->canTweakAlphaForCoverage();
+ return this->getXPFactory()->canTweakAlphaForCoverage();
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698