aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGr.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-03 10:40:13 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-03 10:40:13 -0800
commit378092f3d10b1dd62967f419c35cfefec7c10ee7 (patch)
tree2053505fc4cccddb5a366ef26897128b2a65b0cd /src/gpu/SkGr.cpp
parent5ab7e80f2b477c55be9861ab1c56e33e19aa97a6 (diff)
Add XferProcessor factory in GrPaint and GrDrawState.
In this CL the XP should have zero effect on the actual rendering pipeline. BUG=skia: Review URL: https://codereview.chromium.org/751283002
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r--src/gpu/SkGr.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index d71b05ad7d..dadf9f23ee 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