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

Unified Diff: src/core/SkXfermodeInterpretation.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/SkXfermode.cpp ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermodeInterpretation.cpp
diff --git a/src/core/SkXfermodeInterpretation.cpp b/src/core/SkXfermodeInterpretation.cpp
index 1b2c8e32e6315cef7ceefafd9f11379585f8a6ec..3a1da368d7c54d0926d82b3804bd084b7053dd1a 100644
--- a/src/core/SkXfermodeInterpretation.cpp
+++ b/src/core/SkXfermodeInterpretation.cpp
@@ -9,38 +9,31 @@
#include "SkPaint.h"
static bool just_solid_color(const SkPaint& p) {
- return SK_AlphaOPAQUE == p.getAlpha()
- && !p.getColorFilter() && !p.getShader();
+ return SK_AlphaOPAQUE == p.getAlpha() && !p.getColorFilter() && !p.getShader();
}
-SkXfermodeInterpretation SkInterpretXfermode(const SkPaint& paint,
- bool dstIsOpaque) {
- const SkXfermode* xfer = paint.getXfermode();
- SkXfermode::Mode mode;
- if (!SkXfermode::AsMode(xfer, &mode)) {
- return kNormal_SkXfermodeInterpretation;
- }
- switch (mode) {
- case SkXfermode::kSrcOver_Mode:
+SkXfermodeInterpretation SkInterpretXfermode(const SkPaint& paint, bool dstIsOpaque) {
+ switch (paint.getBlendMode()) {
+ case SkBlendMode::kSrcOver:
return kSrcOver_SkXfermodeInterpretation;
- case SkXfermode::kSrc_Mode:
+ case SkBlendMode::kSrc:
if (just_solid_color(paint)) {
return kSrcOver_SkXfermodeInterpretation;
}
return kNormal_SkXfermodeInterpretation;
- case SkXfermode::kDst_Mode:
+ case SkBlendMode::kDst:
return kSkipDrawing_SkXfermodeInterpretation;
- case SkXfermode::kDstOver_Mode:
+ case SkBlendMode::kDstOver:
if (dstIsOpaque) {
return kSkipDrawing_SkXfermodeInterpretation;
}
return kNormal_SkXfermodeInterpretation;
- case SkXfermode::kSrcIn_Mode:
+ case SkBlendMode::kSrcIn:
if (dstIsOpaque && just_solid_color(paint)) {
return kSrcOver_SkXfermodeInterpretation;
}
return kNormal_SkXfermodeInterpretation;
- case SkXfermode::kDstIn_Mode:
+ case SkBlendMode::kDstIn:
if (just_solid_color(paint)) {
return kSkipDrawing_SkXfermodeInterpretation;
}
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698