Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1768)

Unified Diff: src/gpu/SkGr.cpp

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comiple bug Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrProcessor.cpp ('k') | src/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/GrProcessor.cpp ('k') | src/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698