aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/aaxfermodes.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-05 14:03:43 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-05 18:31:17 +0000
commit2b2fc7db4f8a4a4d4a51d7eb4df6aa62e309928d (patch)
treecfa3f2de434cb5dcabf98720460105964f78bfc3 /gm/aaxfermodes.cpp
parentdbb84c268bd09d2aa47256b5315a87f891583b6b (diff)
Revert[6] "replace SkXfermode obj with SkBlendMode enum in paints"
- perform version check in CreateProc for XfermodeImageFilter and ArithmeticImageFilter This reverts commit 3ed485f4249e17abb4b11f5018d03175fd1afb44. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2992 Change-Id: Ib4a154cdd5f5d1dcac921ef50d53b79a2d6a1be8 Reviewed-on: https://skia-review.googlesource.com/2992 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;