aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/aaxfermodes.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-04 10:06:20 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-04 20:09:34 +0000
commit1834242ec6e3cd62669227d394bc79e1cd66dcfb (patch)
treec956e75f272619b5901ca0beab31dbf4a50d9974 /gm/aaxfermodes.cpp
parent6942442ef7cc018ac136dd379ad6a30902a060e5 (diff)
Revert[4] "replace SkXfermode obj with SkBlendMode enum in paints"
This reverts commit 2cbcd12281ee807214df094964c584c78932e10b. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2924 Change-Id: I0fa5c58af428f3da8565465d1219a34ef8417d9a Reviewed-on: https://skia-review.googlesource.com/2924 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'gm/aaxfermodes.cpp')
-rw-r--r--gm/aaxfermodes.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/gm/aaxfermodes.cpp b/gm/aaxfermodes.cpp
index 678a8379e3..7106ce8174 100644
--- a/gm/aaxfermodes.cpp
+++ b/gm/aaxfermodes.cpp
@@ -121,7 +121,7 @@ protected:
if (firstMode + m > SkXfermode::kLastMode) {
break;
}
- SkXfermode::Mode mode = static_cast<SkXfermode::Mode>(firstMode + m);
+ SkBlendMode mode = static_cast<SkBlendMode>(firstMode + m);
canvas->save();
if (kShape_Pass == drawingPass) {
@@ -144,7 +144,7 @@ protected:
10);
} else {
SkASSERT(kBackground_Pass == drawingPass);
- canvas->drawColor(kBGColor, SkXfermode::kSrc_Mode);
+ canvas->drawColor(kBGColor, SkBlendMode::kSrc);
}
canvas->restore();
} else {
@@ -190,18 +190,17 @@ protected:
canvas->restore();
}
- void drawModeName(SkCanvas* canvas, SkXfermode::Mode mode) {
- const char* modeName = mode <= SkXfermode::kLastMode ? SkXfermode::ModeName(mode)
- : "Arithmetic";
+ void drawModeName(SkCanvas* canvas, SkBlendMode mode) {
+ const char* modeName = SkXfermode::ModeName(mode);
fLabelPaint.setTextAlign(SkPaint::kRight_Align);
canvas->drawText(modeName, strlen(modeName), kLabelSpacing - kShapeSize / 4,
fLabelPaint.getTextSize() / 4, fLabelPaint);
}
- void setupShapePaint(SkCanvas* canvas, GrColor color, SkXfermode::Mode mode, SkPaint* paint) {
+ void setupShapePaint(SkCanvas* canvas, GrColor color, SkBlendMode mode, SkPaint* paint) {
paint->setColor(color);
- if (mode == SkXfermode::kPlus_Mode) {
+ if (mode == SkBlendMode::kPlus) {
// Check for overflow, otherwise we might get confusing AA artifacts.
int maxSum = SkTMax(SkTMax(SkColorGetA(kBGColor) + SkColorGetA(color),
SkColorGetR(kBGColor) + SkColorGetR(color)),
@@ -211,7 +210,7 @@ protected:
if (maxSum > 255) {
SkPaint dimPaint;
dimPaint.setAntiAlias(false);
- dimPaint.setXfermodeMode(SkXfermode::kDstIn_Mode);
+ dimPaint.setBlendMode(SkBlendMode::kDstIn);
if (255 != paint->getAlpha()) {
// Dim the src and dst colors.
dimPaint.setARGB(255 * 255 / maxSum, 0, 0, 0);
@@ -227,11 +226,11 @@ protected:
}
}
- void drawShape(SkCanvas* canvas, Shape shape, const SkPaint& paint, SkXfermode::Mode mode) {
- SkASSERT(mode <= SkXfermode::kLastMode);
+ void drawShape(SkCanvas* canvas, Shape shape, const SkPaint& paint, SkBlendMode mode) {
+ SkASSERT(mode <= SkBlendMode::kLastMode);
SkPaint shapePaint(paint);
shapePaint.setAntiAlias(kSquare_Shape != shape);
- shapePaint.setXfermodeMode(mode);
+ shapePaint.setBlendMode(mode);
switch (shape) {
case kSquare_Shape:
@@ -249,7 +248,7 @@ protected:
case kOval_Shape:
canvas->save();
- canvas->rotate(static_cast<SkScalar>((511 * mode + 257) % 360));
+ canvas->rotate(static_cast<SkScalar>((511 * (int)mode + 257) % 360));
canvas->drawPath(fOval, shapePaint);
canvas->restore();
break;