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

Unified Diff: gm/lcdoverlap.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 | « gm/lcdblendmodes.cpp ('k') | gm/lumafilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/lcdoverlap.cpp
diff --git a/gm/lcdoverlap.cpp b/gm/lcdoverlap.cpp
index 623d74622d4d938d9b87476b2e973519ff35ad34..380878539f3adedcd4dea1895740c8200066723e 100644
--- a/gm/lcdoverlap.cpp
+++ b/gm/lcdoverlap.cpp
@@ -49,8 +49,8 @@ protected:
SkISize onISize() override { return SkISize::Make(kWidth, kHeight); }
- void drawTestCase(SkCanvas* canvas, SkScalar x, SkScalar y, SkXfermode::Mode mode,
- SkXfermode::Mode mode2) {
+ void drawTestCase(SkCanvas* canvas, SkScalar x, SkScalar y, SkBlendMode mode,
+ SkBlendMode mode2) {
const SkColor colors[] {
SK_ColorRED,
SK_ColorGREEN,
@@ -60,8 +60,6 @@ protected:
SK_ColorMAGENTA,
};
- sk_sp<SkXfermode> xfermode(SkXfermode::Make(mode));
- sk_sp<SkXfermode> xfermode2(SkXfermode::Make(mode2));
for (size_t i = 0; i < SK_ARRAY_COUNT(colors); i++) {
canvas->save();
canvas->translate(x, y);
@@ -70,7 +68,7 @@ protected:
SkPaint textPaint;
textPaint.setColor(colors[i]);
- textPaint.setXfermode(i % 2 == 0 ? xfermode : xfermode2);
+ textPaint.setBlendMode(i % 2 == 0 ? mode : mode2);
canvas->drawTextBlob(fBlob, 0, 0, textPaint);
canvas->restore();
}
@@ -79,13 +77,11 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkScalar offsetX = kWidth / 4.0f;
SkScalar offsetY = kHeight / 4.0f;
- drawTestCase(canvas, offsetX, offsetY, SkXfermode::kSrc_Mode, SkXfermode::kSrc_Mode);
- drawTestCase(canvas, 3 * offsetX, offsetY, SkXfermode::kSrcOver_Mode,
- SkXfermode::kSrcOver_Mode);
- drawTestCase(canvas, offsetX, 3 * offsetY, SkXfermode::kHardLight_Mode,
- SkXfermode::kLuminosity_Mode);
- drawTestCase(canvas, 3 * offsetX, 3 * offsetY, SkXfermode::kSrcOver_Mode,
- SkXfermode::kSrc_Mode);
+ drawTestCase(canvas, offsetX, offsetY, SkBlendMode::kSrc, SkBlendMode::kSrc);
+ drawTestCase(canvas, 3 * offsetX, offsetY, SkBlendMode::kSrcOver, SkBlendMode::kSrcOver);
+ drawTestCase(canvas, offsetX, 3 * offsetY, SkBlendMode::kHardLight,
+ SkBlendMode::kLuminosity);
+ drawTestCase(canvas, 3 * offsetX, 3 * offsetY, SkBlendMode::kSrcOver, SkBlendMode::kSrc);
}
private:
« no previous file with comments | « gm/lcdblendmodes.cpp ('k') | gm/lumafilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698