Chromium Code Reviews| Index: src/gpu/SkGr.cpp |
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
| index e4dc467e7f8b9ce2ccd27d5957f505371a515063..e7e34cda048007a49292bb85c50ea3efe6cf391a 100644 |
| --- a/src/gpu/SkGr.cpp |
| +++ b/src/gpu/SkGr.cpp |
| @@ -489,10 +489,14 @@ 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 b.c. kSrcOver_Mode will return a null factory |
|
egdaniel
2016/02/08 16:09:03
Nit: it is not that kSrcOver_Mode will return a nu
robertphillips
2016/02/08 16:24:15
Done.
|
| + SkSafeUnref(grPaint->setXPFactory(xfermode->asXPFactory())); |
| + } |
| #ifndef SK_IGNORE_GPU_DITHER |
| if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) { |