| Index: src/gpu/SkGr.cpp
|
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
|
| index e4dc467e7f8b9ce2ccd27d5957f505371a515063..df65e451feacfdfac1802f197a16f6cc48d29cc8 100644
|
| --- a/src/gpu/SkGr.cpp
|
| +++ b/src/gpu/SkGr.cpp
|
| @@ -489,10 +489,15 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
| }
|
| }
|
|
|
| - SkXfermode* mode = skPaint.getXfermode();
|
| - GrXPFactory* xpFactory = nullptr;
|
| - SkXfermode::AsXPFactory(mode, &xpFactory);
|
| - SkSafeUnref(grPaint->setXPFactory(xpFactory));
|
| + // When the xfermode is null on the SkPaint (meaning kSrcOver) we need the XPFactory field on
|
| + // the GrPaint to also be null (also kSrcOver).
|
| + SkASSERT(!grPaint->getXPFactory());
|
| + SkXfermode* xfermode = skPaint.getXfermode();
|
| + if (xfermode) {
|
| + // SafeUnref in case a new xfermode is added that returns null.
|
| + // In such cases we will fall back to kSrcOver_Mode.
|
| + SkSafeUnref(grPaint->setXPFactory(xfermode->asXPFactory()));
|
| + }
|
|
|
| #ifndef SK_IGNORE_GPU_DITHER
|
| if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) {
|
|
|