Index: src/gpu/effects/GrPorterDuffXferProcessor.cpp |
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp |
index 69e77cfc48348efe741b717ee11f31bd3b4eb1e5..11af4b6aa02404f5518f8b32883db8346fbc9174 100644 |
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp |
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp |
@@ -850,6 +850,12 @@ void GrPorterDuffXPFactory::TestGetXPOutputTypes(const GrXferProcessor* xp, |
//////////////////////////////////////////////////////////////////////////////////////////////// |
// SrcOver Global functions |
//////////////////////////////////////////////////////////////////////////////////////////////// |
+const GrXferProcessor& GrPorterDuffXPFactory::SimpleSrcOverXP() { |
+ static BlendFormula gSrcOverBlendFormula = COEFF_FORMULA(kOne_GrBlendCoeff, |
+ kISA_GrBlendCoeff); |
+ static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula); |
+ return gSrcOverXP; |
+} |
GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor( |
const GrCaps& caps, |
@@ -860,12 +866,11 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor( |
!(optimizations.fCoveragePOI.isSolidWhite() && |
!hasMixedSamples && |
optimizations.fColorPOI.isOpaque())) { |
- static BlendFormula gSrcOverBlendFormula = COEFF_FORMULA(kOne_GrBlendCoeff, |
- kISA_GrBlendCoeff); |
- static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula); |
- SkASSERT(!dstTexture || !dstTexture->texture()); |
- gSrcOverXP.ref(); |
- return &gSrcOverXP; |
+ // We return nullptr here, which our caller interprets as meaning "use SimpleSrcOverXP". |
+ // We don't simply return the address of that XP here because our caller would have to unref |
+ // it and since it is a global object and GrProgramElement's ref-cnting system is not thread |
+ // safe. |
+ return nullptr; |
} |
BlendFormula blendFormula; |