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

Unified Diff: src/core/SkRecordOpts.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/SkRecordDraw.cpp ('k') | src/core/SkSpriteBlitter4f.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordOpts.cpp
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index d46a6573b5f055a12d0cb373d4cad7d4dcaf017a..a7feec1fb36851c1244f8ce77c87f1d6044c9b42 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -98,7 +98,7 @@ static bool fold_opacity_layer_color_to_paint(const SkPaint* layerPaint,
// looper drawing unmodulated filter layer twice and then modulating the result produces
// different image to drawing modulated filter layer twice.
// TODO: most likely the looper and only some xfer modes are the hard constraints
- if (paint->getXfermode() || paint->getLooper()) {
+ if (!paint->isSrcOver() || paint->getLooper()) {
return false;
}
@@ -129,9 +129,9 @@ static bool fold_opacity_layer_color_to_paint(const SkPaint* layerPaint,
}
// The layer paint can not have any effects.
- if (layerPaint->getPathEffect() ||
+ if (layerPaint->getPathEffect() ||
layerPaint->getShader() ||
- layerPaint->getXfermode() ||
+ !layerPaint->isSrcOver() ||
layerPaint->getMaskFilter() ||
layerPaint->getColorFilter() ||
layerPaint->getRasterizer() ||
@@ -174,16 +174,12 @@ void SkRecordNoopSaveRestores(SkRecord* record) {
}
static bool effectively_srcover(const SkPaint* paint) {
- if (!paint) {
- return true;
- }
- SkXfermode* mode = paint->getXfermode();
- if (SkXfermode::IsMode(mode, SkXfermode::kSrcOver_Mode)) {
+ if (!paint || paint->isSrcOver()) {
return true;
}
// src-mode with opaque and no effects (which might change opaqueness) is ok too.
return !paint->getShader() && !paint->getColorFilter() && !paint->getImageFilter() &&
- 0xFF == paint->getAlpha() && SkXfermode::IsMode(mode, SkXfermode::kSrc_Mode);
+ 0xFF == paint->getAlpha() && paint->getBlendMode() == SkBlendMode::kSrc;
}
// For some SaveLayer-[drawing command]-Restore patterns, merge the SaveLayer's alpha into the
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkSpriteBlitter4f.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698