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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 546043002: Don't take a ref on GP in AutoEffectRestore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment 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') | src/gpu/GrProgramElement.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 6acc202065b78a4872c2f52846709ab5c0b6e076..f2028eaf94fb182aabe6c0091cc69ab6df76c3c0 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -300,12 +300,12 @@ GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(
void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
if (NULL != fDrawState) {
// See the big comment on the class definition about GPs.
- if (NULL != fOriginalGP) {
- SkASSERT(fDrawState->getGeometryProcessor()->getEffect() == fOriginalGP);
- fOriginalGP->unref();
- fOriginalGP = NULL;
- } else {
+ if (SK_InvalidUniqueID == fOriginalGPID) {
fDrawState->fGeometryProcessor.reset(NULL);
+ } else {
+ SkASSERT(fDrawState->getGeometryProcessor()->getEffect()->getUniqueID() ==
+ fOriginalGPID);
+ fOriginalGPID = SK_InvalidUniqueID;
}
int m = fDrawState->numColorStages() - fColorEffectCnt;
@@ -322,9 +322,9 @@ void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
}
fDrawState = ds;
if (NULL != ds) {
- SkASSERT(NULL == fOriginalGP);
+ SkASSERT(SK_InvalidUniqueID == fOriginalGPID);
if (NULL != ds->getGeometryProcessor()) {
- fOriginalGP = SkRef(ds->getGeometryProcessor()->getEffect());
+ fOriginalGPID = ds->getGeometryProcessor()->getEffect()->getUniqueID();
}
fColorEffectCnt = ds->numColorStages();
fCoverageEffectCnt = ds->numCoverageStages();
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrProgramElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698