diff options
author | Mike Reed <reed@google.com> | 2016-10-03 15:44:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-03 20:02:20 +0000 |
commit | 70cdb396eb5ffbbed128b902532e9292b5ec0e9d (patch) | |
tree | d6a3bc707ac55d6823f7966adfacd88c6f23d903 /src/gpu | |
parent | afb48b62272e280d766f8e97c9cdd3417961a546 (diff) |
Revert "Revert "replace SkXfermode obj with SkBlendMode enum in paints""
This reverts commit ce02e7175872abde3721df9e5d3ec0ab8384cd8e.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2878
Change-Id: I86875511a13497112827cbaed1dbd7639e9e3d10
Reviewed-on: https://skia-review.googlesource.com/2878
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrContext.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrDrawContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrSWMaskHelper.cpp | 22 | ||||
-rw-r--r-- | src/gpu/GrTextureParamsAdjuster.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrTextureToYUVPlanes.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrYUVProvider.cpp | 2 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/text/GrTextUtils.cpp | 3 |
9 files changed, 24 insertions, 25 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6cec1da86b..176d5da59b 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(SkXfermode::kSrc_Mode); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); 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(SkXfermode::kSrc_Mode); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); 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 e9a9619da5..42d6795903 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::kSrc_Mode)); + paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::Mode::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 a20eacb75c..747b7574be 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 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 +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 }; return modeMap[op]; @@ -42,7 +42,7 @@ void GrSWMaskHelper::drawRect(const SkRect& rect, SkRegion::Op op, bool antiAlias, uint8_t alpha) { SkPaint paint; - paint.setXfermode(SkXfermode::Make(op_to_mode(op))); + paint.setBlendMode(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.setXfermodeMode(op_to_mode(op)); + paint.setBlendMode(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 3ca90f5adb..f51cc54aba 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(SkXfermode::kSrc_Mode); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); SkRect localRect; if (subset) { diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp index 5e7dafecf3..93a62d2643 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(SkXfermode::kSrc_Mode); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); 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 b187ec3888..db58e0afed 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -142,7 +142,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx, } } - paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); 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 d4db461c57..ee4e40a642 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -20,6 +20,7 @@ #include "GrXferProcessor.h" #include "GrYUVProvider.h" +#include "SkBlendModePriv.h" #include "SkColorFilter.h" #include "SkConfig8888.h" #include "SkCanvas.h" @@ -680,9 +681,8 @@ 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()); - SkXfermode* xfermode = skPaint.getXfermode(); - if (xfermode) { - grPaint->setXPFactory(xfermode->asXPFactory()); + if (!skPaint.isSrcOver()) { + grPaint->setXPFactory(SkBlendMode_AsXPFactory(skPaint.getBlendMode())); } #ifndef SK_IGNORE_GPU_DITHER diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 4eb7a11c76..80a0314ac2 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(SkXfermode::kSrc_Mode); + paint1.setPorterDuffXPFactory(SkBlendMode::kSrc); readDC->fillRectToRect(GrNoClip(), paint1, SkMatrix::I(), kDstRect, kSrcRect); readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, firstRead); paint2.addColorFragmentProcessor(std::move(upmToPM)); - paint2.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); + paint2.setPorterDuffXPFactory(SkBlendMode::kSrc); tempDC->fillRectToRect(GrNoClip(), paint2, SkMatrix::I(), kDstRect, kSrcRect); paint3.addColorFragmentProcessor(std::move(pmToUPM2)); - paint3.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); + paint3.setPorterDuffXPFactory(SkBlendMode::kSrc); readDC->fillRectToRect(GrNoClip(), paint3, SkMatrix::I(), kDstRect, kSrcRect); diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 56d4ec1c00..a5685f0381 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -547,8 +547,7 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context, } bool GrTextUtils::ShouldDisableLCD(const SkPaint& paint) { - return !SkXfermode::AsMode(paint.getXfermode(), nullptr) || - paint.getMaskFilter() || + return paint.getMaskFilter() || paint.getRasterizer() || paint.getPathEffect() || paint.isFakeBoldText() || |