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

Unified Diff: samplecode/SampleXfermodesBlur.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 | « samplecode/SampleXfer.cpp ('k') | src/c/sk_paint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleXfermodesBlur.cpp
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index ef25114cf01d2cbabd39932fad2c88e86293060e..fe07c9b5671a904ad5ebdf22ebe52e93e00abfe7 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -37,8 +37,7 @@ class XfermodesBlurView : public SampleView {
SkBitmap fBG;
SkBitmap fSrcB, fDstB;
- void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha,
- SkScalar x, SkScalar y) {
+ void draw_mode(SkCanvas* canvas, SkBlendMode mode, int alpha, SkScalar x, SkScalar y) {
SkPaint p;
p.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(5),
@@ -55,7 +54,7 @@ class XfermodesBlurView : public SampleView {
r.offset(x, y);
canvas->drawOval(r, p);
- p.setXfermode(std::move(mode));
+ p.setBlendMode(mode);
// draw a square overlapping the circle
// in the lower right of the canvas
@@ -110,34 +109,23 @@ protected:
}
const struct {
- SkXfermode::Mode fMode;
- const char* fLabel;
+ SkBlendMode fMode;
+ const char* fLabel;
} gModes[] = {
- { SkXfermode::kClear_Mode, "Clear" },
- { SkXfermode::kSrc_Mode, "Src" },
- { SkXfermode::kDst_Mode, "Dst" },
- { SkXfermode::kSrcOver_Mode, "SrcOver" },
- { SkXfermode::kDstOver_Mode, "DstOver" },
- { SkXfermode::kSrcIn_Mode, "SrcIn" },
- { SkXfermode::kDstIn_Mode, "DstIn" },
- { SkXfermode::kSrcOut_Mode, "SrcOut" },
- { SkXfermode::kDstOut_Mode, "DstOut" },
- { SkXfermode::kSrcATop_Mode, "SrcATop" },
- { SkXfermode::kDstATop_Mode, "DstATop" },
- { SkXfermode::kXor_Mode, "Xor" },
-
- { SkXfermode::kPlus_Mode, "Plus" },
- /*{ SkXfermode::kModulate_Mode, "Modulate" },
- { SkXfermode::kScreen_Mode, "Screen" },
- { SkXfermode::kOverlay_Mode, "Overlay" },
- { SkXfermode::kDarken_Mode, "Darken" },
- { SkXfermode::kLighten_Mode, "Lighten" },
- { SkXfermode::kColorDodge_Mode, "ColorDodge" },
- { SkXfermode::kColorBurn_Mode, "ColorBurn" },
- { SkXfermode::kHardLight_Mode, "HardLight" },
- { SkXfermode::kSoftLight_Mode, "SoftLight" },
- { SkXfermode::kDifference_Mode, "Difference" },
- { SkXfermode::kExclusion_Mode, "Exclusion" },*/
+ { SkBlendMode::kClear, "Clear" },
+ { SkBlendMode::kSrc, "Src" },
+ { SkBlendMode::kDst, "Dst" },
+ { SkBlendMode::kSrcOver, "SrcOver" },
+ { SkBlendMode::kDstOver, "DstOver" },
+ { SkBlendMode::kSrcIn, "SrcIn" },
+ { SkBlendMode::kDstIn, "DstIn" },
+ { SkBlendMode::kSrcOut, "SrcOut" },
+ { SkBlendMode::kDstOut, "DstOut" },
+ { SkBlendMode::kSrcATop, "SrcATop" },
+ { SkBlendMode::kDstATop, "DstATop" },
+ { SkBlendMode::kXor, "Xor" },
+
+ { SkBlendMode::kPlus, "Plus" },
};
const SkScalar w = SkIntToScalar(W);
@@ -168,8 +156,7 @@ protected:
canvas->drawRect(r, p);
canvas->saveLayer(&r, nullptr);
- draw_mode(canvas, SkXfermode::Make(gModes[i].fMode),
- twice ? 0x88 : 0xFF, r.fLeft, r.fTop);
+ draw_mode(canvas, gModes[i].fMode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop);
canvas->restore();
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
« no previous file with comments | « samplecode/SampleXfer.cpp ('k') | src/c/sk_paint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698