Use SkBlendMode_Name rather than one-off tables
BUG=skia:
Change-Id: I653ff55bc1164ddae4b03967f2f54bb5fece5a33
Reviewed-on: https://skia-review.googlesource.com/9722
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/samplecode/SampleHairModes.cpp b/samplecode/SampleHairModes.cpp
index 5eeb6cb..dfe7572 100644
--- a/samplecode/SampleHairModes.cpp
+++ b/samplecode/SampleHairModes.cpp
@@ -11,22 +11,19 @@
#include "SkColorPriv.h"
#include "SkShader.h"
-static const struct {
- SkBlendMode fMode;
- const char* fLabel;
-} gModes[] = {
- { 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" },
+static const SkBlendMode gModes[] = {
+ SkBlendMode::kClear,
+ SkBlendMode::kSrc,
+ SkBlendMode::kDst,
+ SkBlendMode::kSrcOver,
+ SkBlendMode::kDstOver,
+ SkBlendMode::kSrcIn,
+ SkBlendMode::kDstIn,
+ SkBlendMode::kSrcOut,
+ SkBlendMode::kDstOut,
+ SkBlendMode::kSrcATop,
+ SkBlendMode::kDstATop,
+ SkBlendMode::kXor,
};
const int gWidth = 64;
@@ -105,7 +102,7 @@
}
canvas->drawRect(bounds, fBGPaint);
canvas->saveLayer(&bounds, nullptr);
- SkScalar dy = drawCell(canvas, gModes[i].fMode,
+ SkScalar dy = drawCell(canvas, gModes[i],
gAlphaValue[alpha & 1],
gAlphaValue[alpha & 2]);
canvas->restore();