aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleXfermodesBlur.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'samplecode/SampleXfermodesBlur.cpp')
-rw-r--r--samplecode/SampleXfermodesBlur.cpp51
1 files changed, 19 insertions, 32 deletions
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index ef25114cf0..fe07c9b567 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);