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

Unified Diff: samplecode/SampleAARectModes.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 | « public.bzl ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « public.bzl ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698