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

Unified Diff: src/core/SkBlitter.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 months 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/core/SkBlendModePriv.h ('k') | src/core/SkBlitter_A8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter.cpp
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index b57bd43ad0a4ebe7bd123a03f4afadda235e7f3e..3643e667601d2b8a60c0ee4e4000d56f541a7a0c 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -815,7 +815,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkShader* shader = origPaint.getShader();
SkColorFilter* cf = origPaint.getColorFilter();
- SkXfermode* mode = origPaint.getXfermode();
+ SkBlendMode mode = origPaint.getBlendMode();
sk_sp<Sk3DShader> shader3D;
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
@@ -828,12 +828,12 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
shader = shader3D.get();
}
- if (mode) {
+ if (mode != SkBlendMode::kSrcOver) {
bool deviceIsOpaque = kRGB_565_SkColorType == device.colorType();
switch (SkInterpretXfermode(*paint, deviceIsOpaque)) {
case kSrcOver_SkXfermodeInterpretation:
- mode = nullptr;
- paint.writable()->setXfermode(nullptr);
+ mode = SkBlendMode::kSrcOver;
+ paint.writable()->setBlendMode(mode);
break;
case kSkipDrawing_SkXfermodeInterpretation:{
return allocator->createT<SkNullBlitter>();
@@ -848,13 +848,13 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
* color/shader/colorfilter, and just pretend we're SRC + color==0. This
* will fall into our optimizations for SRC mode.
*/
- if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
+ if (mode == SkBlendMode::kClear) {
SkPaint* p = paint.writable();
p->setShader(nullptr);
shader = nullptr;
p->setColorFilter(nullptr);
cf = nullptr;
- mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
+ p->setBlendMode(mode = SkBlendMode::kSrc);
p->setColor(0);
}
@@ -863,7 +863,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
}
if (nullptr == shader) {
- if (mode) {
+ if (mode != SkBlendMode::kSrcOver) {
// xfermodes (and filters) require shaders for our current blitters
paint.writable()->setShader(SkShader::MakeColorShader(paint->getColor()));
paint.writable()->setAlpha(0xFF);
@@ -914,7 +914,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
case kAlpha_8_SkColorType:
if (drawCoverage) {
SkASSERT(nullptr == shader);
- SkASSERT(nullptr == paint->getXfermode());
+ SkASSERT(paint->isSrcOver());
blitter = allocator->createT<SkA8_Coverage_Blitter>(device, *paint);
} else if (shader) {
blitter = allocator->createT<SkA8_Shader_Blitter>(device, *paint, shaderContext);
« no previous file with comments | « src/core/SkBlendModePriv.h ('k') | src/core/SkBlitter_A8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698