Index: samplecode/SampleAARectModes.cpp |
diff --git a/samplecode/SampleAARectModes.cpp b/samplecode/SampleAARectModes.cpp |
index 65b1da140536ff6d6600da6014880f3ac3979288..0a50303935f50eed66f015a84176ca2e392ac905 100644 |
--- a/samplecode/SampleAARectModes.cpp |
+++ b/samplecode/SampleAARectModes.cpp |
@@ -12,21 +12,21 @@ |
#include "SkShader.h" |
static 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" }, |
+ { 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" }, |
}; |
const int gWidth = 64; |
@@ -34,7 +34,7 @@ const int gHeight = 64; |
const SkScalar W = SkIntToScalar(gWidth); |
const SkScalar H = SkIntToScalar(gHeight); |
-static SkScalar drawCell(SkCanvas* canvas, const sk_sp<SkXfermode>& mode, SkAlpha a0, SkAlpha a1) { |
+static SkScalar drawCell(SkCanvas* canvas, SkBlendMode mode, SkAlpha a0, SkAlpha a1) { |
SkPaint paint; |
paint.setAntiAlias(true); |
@@ -47,7 +47,7 @@ static SkScalar drawCell(SkCanvas* canvas, const sk_sp<SkXfermode>& mode, SkAlph |
paint.setColor(SK_ColorRED); |
paint.setAlpha(a1); |
- paint.setXfermode(mode); |
+ paint.setBlendMode(mode); |
SkScalar offset = SK_Scalar1 / 3; |
SkRect rect = SkRect::MakeXYWH(W / 4 + offset, |
@@ -106,11 +106,10 @@ protected: |
canvas->translate(W * 5, 0); |
canvas->save(); |
} |
- sk_sp<SkXfermode> mode = SkXfermode::Make(gModes[i].fMode); |
canvas->drawRect(bounds, fBGPaint); |
canvas->saveLayer(&bounds, nullptr); |
- SkScalar dy = drawCell(canvas, mode, gAlphaValue[alpha & 1], |
+ SkScalar dy = drawCell(canvas, gModes[i].fMode, gAlphaValue[alpha & 1], |
gAlphaValue[alpha & 2]); |
canvas->restore(); |