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

Unified Diff: src/gpu/GrDrawState.h

Issue 676983003: Clip mask manager sets stencil on draw type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bug fix Created 6 years, 2 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/GrClipMaskManager.cpp ('k') | src/gpu/GrGpu.h » ('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 3043fd76d52afb6169cb08381ee8f9cb88f84fc1..71c44d4867916bc6366fb288e1a1e4eed3242819 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -346,6 +346,36 @@ public:
int fCoverageEffectCnt;
};
+ /**
+ * AutoRestoreStencil
+ *
+ * This simple struct saves and restores the stencil settings
+ */
+ class AutoRestoreStencil : public ::SkNoncopyable {
+ public:
+ AutoRestoreStencil() : fDrawState(NULL) {}
+
+ AutoRestoreStencil(GrDrawState* ds) : fDrawState(NULL) { this->set(ds); }
+
+ ~AutoRestoreStencil() { this->set(NULL); }
+
+ void set(GrDrawState* ds) {
+ if (fDrawState) {
+ fDrawState->setStencil(fStencilSettings);
+ }
+ fDrawState = ds;
+ if (ds) {
+ fStencilSettings = ds->getStencil();
+ }
+ }
+
+ bool isSet() const { return SkToBool(fDrawState); }
+
+ private:
+ GrDrawState* fDrawState;
+ GrStencilSettings fStencilSettings;
+ };
+
/// @}
///////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698