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

Unified Diff: src/core/SkDraw.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/SkCanvas.cpp ('k') | src/core/SkGpuBlurUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 53c8e5f0e886a7f93a217213cb5b36ee4571ab52..2a88781e483cfb2bb45d332f2bd2b4ff4fdf1a0e 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -7,6 +7,7 @@
#define __STDC_LIMIT_MACROS
#include "SkDraw.h"
+#include "SkBlendModePriv.h"
#include "SkBlitter.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
@@ -163,31 +164,27 @@ static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
return nullptr;
}
- SkXfermode::Mode mode;
- if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) {
- return nullptr;
- }
-
+ SkBlendMode mode = paint.getBlendMode();
SkColor color = paint.getColor();
// collaps modes based on color...
- if (SkXfermode::kSrcOver_Mode == mode) {
+ if (SkBlendMode::kSrcOver == mode) {
unsigned alpha = SkColorGetA(color);
if (0 == alpha) {
- mode = SkXfermode::kDst_Mode;
+ mode = SkBlendMode::kDst;
} else if (0xFF == alpha) {
- mode = SkXfermode::kSrc_Mode;
+ mode = SkBlendMode::kSrc;
}
}
switch (mode) {
- case SkXfermode::kClear_Mode:
+ case SkBlendMode::kClear:
// SkDebugf("--- D_Clear_BitmapXferProc\n");
return D_Clear_BitmapXferProc; // ignore data
- case SkXfermode::kDst_Mode:
+ case SkBlendMode::kDst:
// SkDebugf("--- D_Dst_BitmapXferProc\n");
return D_Dst_BitmapXferProc; // ignore data
- case SkXfermode::kSrc_Mode: {
+ case SkBlendMode::kSrc: {
/*
should I worry about dithering for the lower depths?
*/
@@ -1143,7 +1140,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
if (SkDrawTreatAsHairline(origPaint, *matrix, &coverage)) {
if (SK_Scalar1 == coverage) {
paint.writable()->setStrokeWidth(0);
- } else if (SkXfermode::SupportsCoverageAsAlpha(origPaint.getXfermode())) {
+ } else if (SkBlendMode_SupportsCoverageAsAlpha(origPaint.getBlendMode())) {
U8CPU newAlpha;
#if 0
newAlpha = SkToU8(SkScalarRoundToInt(coverage *
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698