Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index d71b05ad7d16f8742d66c30aceb3ed40651ceb7e..dadf9f23ee46355e4bb1d7789c5c790350aed324 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -6,15 +6,18 @@ |
*/ |
#include "SkGr.h" |
+ |
+#include "GrDrawTargetCaps.h" |
+#include "GrGpu.h" |
+#include "GrXferProcessor.h" |
#include "SkColorFilter.h" |
#include "SkConfig8888.h" |
#include "SkData.h" |
#include "SkMessageBus.h" |
#include "SkPixelRef.h" |
#include "SkTextureCompressor.h" |
-#include "GrGpu.h" |
#include "effects/GrDitherEffect.h" |
-#include "GrDrawTargetCaps.h" |
+#include "effects/GrPorterDuffXferProcessor.h" |
#include "effects/GrYUVtoRGBEffect.h" |
#ifndef SK_IGNORE_ETC1_SUPPORT |
@@ -465,19 +468,27 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor |
SkXfermode::Coeff dm; |
SkXfermode* mode = skPaint.getXfermode(); |
- GrFragmentProcessor* xferProcessor = NULL; |
- if (SkXfermode::asFragmentProcessorOrCoeff(mode, &xferProcessor, &sm, &dm)) { |
- if (xferProcessor) { |
- grPaint->addColorProcessor(xferProcessor)->unref(); |
+ GrFragmentProcessor* fragmentProcessor = NULL; |
+ GrXPFactory* xpFactory = NULL; |
+ if (SkXfermode::AsFragmentProcessorOrXPFactory(mode, &fragmentProcessor, &xpFactory, |
+ &sm, &dm)) { |
+ if (fragmentProcessor) { |
+ SkASSERT(NULL == xpFactory); |
+ grPaint->addColorProcessor(fragmentProcessor)->unref(); |
+ xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kOne_Coeff, |
+ SkXfermode::kZero_Coeff); |
sm = SkXfermode::kOne_Coeff; |
dm = SkXfermode::kZero_Coeff; |
} |
} else { |
- //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) |
// Fall back to src-over |
+ xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kOne_Coeff, |
+ SkXfermode::kISA_Coeff); |
sm = SkXfermode::kOne_Coeff; |
dm = SkXfermode::kISA_Coeff; |
} |
+ SkASSERT(xpFactory); |
+ grPaint->setXPFactory(xpFactory)->unref(); |
grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); |
//set the color of the paint to the one of the parameter |