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

Unified Diff: src/gpu/GrDrawState.cpp

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 | « src/gpu/GrDrawState.h ('k') | no next file » | 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 236d48f229ef2b478a7e1e77c5f13bca4e190326..6acc202065b78a4872c2f52846709ab5c0b6e076 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -299,7 +299,14 @@ GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(
void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
if (NULL != fDrawState) {
- fDrawState->fGeometryProcessor.reset(fGeometryProcessor.detach());
+ // See the big comment on the class definition about GPs.
+ if (NULL != fOriginalGP) {
+ SkASSERT(fDrawState->getGeometryProcessor()->getEffect() == fOriginalGP);
+ fOriginalGP->unref();
+ fOriginalGP = NULL;
+ } else {
+ fDrawState->fGeometryProcessor.reset(NULL);
+ }
int m = fDrawState->numColorStages() - fColorEffectCnt;
SkASSERT(m >= 0);
@@ -315,10 +322,9 @@ void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
}
fDrawState = ds;
if (NULL != ds) {
- if (ds->hasGeometryProcessor()) {
- fGeometryProcessor.reset(SkNEW_ARGS(GrEffectStage, (*ds->getGeometryProcessor())));
- } else {
- fGeometryProcessor.reset(NULL);
+ SkASSERT(NULL == fOriginalGP);
+ if (NULL != ds->getGeometryProcessor()) {
+ fOriginalGP = SkRef(ds->getGeometryProcessor()->getEffect());
}
fColorEffectCnt = ds->numColorStages();
fCoverageEffectCnt = ds->numCoverageStages();
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698