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

Unified Diff: src/gpu/GrPipeline.h

Issue 1540363002: Don't ref/unref the static src-over xp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tiny Created 5 years 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 | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPipeline.h
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index fbfe119ac0dedebef3a9b93bea08059740858b02..60d0cab1aba5b1defb574f1754a96afa374aa036 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -103,7 +103,15 @@ public:
}
int numFragmentProcessors() const { return fFragmentProcessors.count(); }
- const GrXferProcessor* getXferProcessor() const { return fXferProcessor.get(); }
+ const GrXferProcessor& getXferProcessor() const {
+ if (fXferProcessor.get()) {
+ return *fXferProcessor.get();
+ } else {
+ // A null xp member means the common src-over case. GrXferProcessor's ref'ing
+ // mechanism is not thread safe so we do not hold a ref on this global.
+ return GrPorterDuffXPFactory::SimpleSrcOverXP();
+ }
+ }
const GrFragmentProcessor& getColorFragmentProcessor(int idx) const {
SkASSERT(idx < this->numColorFragmentProcessors());
@@ -136,7 +144,7 @@ public:
bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVertices_Flag); }
GrXferBarrierType xferBarrierType(const GrCaps& caps) const {
- return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps);
+ return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), caps);
}
/**
« no previous file with comments | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698