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

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: capitalization 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
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index a86ee6031701cd1d6ec863251b271127eef775bd..b89f65639e005c30a859edcc558d5cb37f60b3a5 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -6,15 +6,19 @@
*/
#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/GrDefaultXferProcessor.h"
+#include "effects/GrPorterDuffXferProcessor.h"
#include "effects/GrYUVtoRGBEffect.h"
#ifndef SK_IGNORE_ETC1_SUPPORT
@@ -467,21 +471,29 @@ 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
grPaint->setColor(paintColor);

Powered by Google App Engine
This is Rietveld 408576698