aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-12-21 13:12:54 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-21 13:12:55 -0800
commit2047b7855546b21f7956c398592c070b3f91a9db (patch)
tree1d1c46f1e3248373f58c0d72b897077621b6ea00 /src/gpu/effects
parentbada1885da479d948f065182d6dfa85a1140bda5 (diff)
Don't ref/unref the static src-over xp
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 69e77cfc48..11af4b6aa0 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;