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

Unified Diff: src/gpu/GrDrawState.h

Issue 545253002: Change behavior of GrDS::AutoEffectRestort wrt GPs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra period Created 6 years, 3 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 | « no previous file | 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 a1b07de6d6cdb04331e044ec6444939a8016e10a..7b5f150f4c68525774f26df8e3d3a7506ffb6f14 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -237,14 +237,34 @@ public:
}
/**
- * When this object is destroyed it will remove any effects from the draw state that were added
- * after its constructor.
+ * When this object is destroyed it will remove any color/coverage effects from the draw state
+ * that were added after its constructor.
+ *
+ * This class has strange behavior around geometry processor. If there is a GP on the draw state
+ * it will assert that the GP is not modified until after the destructor of the ARE. If the
+ * draw state has a NULL GP when the ARE is constructed then it will reset it to null in the
+ * destructor.
+ *
+ * TODO: We'd prefer for the ARE to just save and restore the GP. However, this would add
+ * significant complexity to the multi-ref architecture for deferred drawing. Once GrDrawState
+ * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred
+ * execution state and GrOptDrawState always will be (and will be immutable and therefore
+ * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore
+ * the GP.
*/
class AutoRestoreEffects : public ::SkNoncopyable {
public:
- AutoRestoreEffects() : fDrawState(NULL), fColorEffectCnt(0), fCoverageEffectCnt(0) {}
-
- AutoRestoreEffects(GrDrawState* ds) : fDrawState(NULL), fColorEffectCnt(0), fCoverageEffectCnt(0) {
+ AutoRestoreEffects()
+ : fDrawState(NULL)
+ , fOriginalGP(NULL)
+ , fColorEffectCnt(0)
+ , fCoverageEffectCnt(0) {}
+
+ AutoRestoreEffects(GrDrawState* ds)
+ : fDrawState(NULL)
+ , fOriginalGP(NULL)
+ , fColorEffectCnt(0)
+ , fCoverageEffectCnt(0) {
this->set(ds);
}
@@ -255,10 +275,10 @@ public:
bool isSet() const { return NULL != fDrawState; }
private:
- GrDrawState* fDrawState;
- SkAutoTDelete<GrEffectStage> fGeometryProcessor;
- int fColorEffectCnt;
- int fCoverageEffectCnt;
+ GrDrawState* fDrawState;
+ const GrEffect* fOriginalGP;
+ int fColorEffectCnt;
+ int fCoverageEffectCnt;
};
/// @}
« no previous file with comments | « no previous file | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698