aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrDrawContext.cpp2
-rw-r--r--src/gpu/GrSWMaskHelper.cpp22
-rw-r--r--src/gpu/GrTextureParamsAdjuster.cpp2
-rw-r--r--src/gpu/GrTextureToYUVPlanes.cpp2
-rw-r--r--src/gpu/GrYUVProvider.cpp2
-rw-r--r--src/gpu/SkGr.cpp6
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp6
-rw-r--r--src/gpu/text/GrTextUtils.cpp3
9 files changed, 25 insertions, 24 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 176d5da59b..6cec1da86b 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -356,7 +356,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
paint.setAllowSRGBInputs(true);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
@@ -471,7 +471,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
if (fp) {
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
paint.setAllowSRGBInputs(true);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
tempDC->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nullptr);
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 42d6795903..e9a9619da5 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -241,7 +241,7 @@ void GrDrawContext::internalClear(const GrFixedClip& clip,
GrPaint paint;
paint.setColor4f(GrColor4f::FromGrColor(color));
- paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::Mode::kSrc_Mode));
+ paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
this->drawRect(clip, paint, SkMatrix::I(), clearRect);
} else if (isFull) {
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 747b7574be..a20eacb75c 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -21,15 +21,15 @@
/*
* Convert a boolean operation into a transfer mode code
*/
-static SkBlendMode op_to_mode(SkRegion::Op op) {
-
- static const SkBlendMode modeMap[] = {
- SkBlendMode::kDstOut, // kDifference_Op
- SkBlendMode::kModulate, // kIntersect_Op
- SkBlendMode::kSrcOver, // kUnion_Op
- SkBlendMode::kXor, // kXOR_Op
- SkBlendMode::kClear, // kReverseDifference_Op
- SkBlendMode::kSrc, // kReplace_Op
+static SkXfermode::Mode op_to_mode(SkRegion::Op op) {
+
+ static const SkXfermode::Mode modeMap[] = {
+ SkXfermode::kDstOut_Mode, // kDifference_Op
+ SkXfermode::kModulate_Mode, // kIntersect_Op
+ SkXfermode::kSrcOver_Mode, // kUnion_Op
+ SkXfermode::kXor_Mode, // kXOR_Op
+ SkXfermode::kClear_Mode, // kReverseDifference_Op
+ SkXfermode::kSrc_Mode, // kReplace_Op
};
return modeMap[op];
@@ -42,7 +42,7 @@ void GrSWMaskHelper::drawRect(const SkRect& rect, SkRegion::Op op,
bool antiAlias, uint8_t alpha) {
SkPaint paint;
- paint.setBlendMode(op_to_mode(op));
+ paint.setXfermode(SkXfermode::Make(op_to_mode(op)));
paint.setAntiAlias(antiAlias);
paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
@@ -65,7 +65,7 @@ void GrSWMaskHelper::drawShape(const GrShape& shape, SkRegion::Op op, bool antiA
SkASSERT(0xFF == paint.getAlpha());
fDraw.drawPathCoverage(path, paint);
} else {
- paint.setBlendMode(op_to_mode(op));
+ paint.setXfermodeMode(op_to_mode(op));
paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
fDraw.drawPath(path, paint);
}
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index f51cc54aba..3ca90f5adb 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -72,7 +72,7 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset,
GrTextureParams params(SkShader::kClamp_TileMode, copyParams.fFilter);
paint.addColorTextureProcessor(inputTexture, nullptr, SkMatrix::I(), params);
}
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRect localRect;
if (subset) {
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 93a62d2643..5e7dafecf3 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -41,7 +41,7 @@ static bool convert_texture(GrTexture* src, GrDrawContext* dst, int dstW, int ds
return false;
}
GrPaint paint;
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
paint.addColorFragmentProcessor(std::move(fp));
dst->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW, dstH));
return true;
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index db58e0afed..b187ec3888 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -142,7 +142,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
}
}
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fWidth,
yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index ee4e40a642..d4db461c57 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -20,7 +20,6 @@
#include "GrXferProcessor.h"
#include "GrYUVProvider.h"
-#include "SkBlendModePriv.h"
#include "SkColorFilter.h"
#include "SkConfig8888.h"
#include "SkCanvas.h"
@@ -681,8 +680,9 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
// 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());
- if (!skPaint.isSrcOver()) {
- grPaint->setXPFactory(SkBlendMode_AsXPFactory(skPaint.getBlendMode()));
+ SkXfermode* xfermode = skPaint.getXfermode();
+ if (xfermode) {
+ grPaint->setXPFactory(xfermode->asXPFactory());
}
#ifndef SK_IGNORE_GPU_DITHER
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 80a0314ac2..4eb7a11c76 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -229,19 +229,19 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
tempDC->asTexture().get(), GrSwizzle::RGBA(), *pmToUPMRule, SkMatrix::I()));
paint1.addColorFragmentProcessor(std::move(pmToUPM1));
- paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint1.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
readDC->fillRectToRect(GrNoClip(), paint1, SkMatrix::I(), kDstRect, kSrcRect);
readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, firstRead);
paint2.addColorFragmentProcessor(std::move(upmToPM));
- paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint2.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
tempDC->fillRectToRect(GrNoClip(), paint2, SkMatrix::I(), kDstRect, kSrcRect);
paint3.addColorFragmentProcessor(std::move(pmToUPM2));
- paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ paint3.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
readDC->fillRectToRect(GrNoClip(), paint3, SkMatrix::I(), kDstRect, kSrcRect);
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index a5685f0381..56d4ec1c00 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -547,7 +547,8 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context,
}
bool GrTextUtils::ShouldDisableLCD(const SkPaint& paint) {
- return paint.getMaskFilter() ||
+ return !SkXfermode::AsMode(paint.getXfermode(), nullptr) ||
+ paint.getMaskFilter() ||
paint.getRasterizer() ||
paint.getPathEffect() ||
paint.isFakeBoldText() ||