82 constexpr int kRectWidth = 20;
85 constexpr int kCheckSize = 10;
111 SkColor alphas[] = {0xFFFFFFFF, 0x80808080};
132 const int kRectsPerRow = std::max(this->
getISize().fWidth / kRectWidth, 1);
133 for (
size_t cfm = 0; cfm < std::size(modes); ++cfm) {
134 for (
size_t cfc = 0; cfc < std::size(colors); ++cfc) {
136 for (
size_t s = 0;
s < std::size(shaders); ++
s) {
137 paint.setShader(shaders[
s]);
138 bool hasShader =
nullptr ==
paint.getShader();
139 int paintColorCnt = hasShader ? std::size(alphas) : std::size(colors);
140 SkColor* paintColors = hasShader ? alphas : colors;
141 for (
int pc = 0; pc < paintColorCnt; ++pc) {
142 paint.setColor(paintColors[pc]);
161 using INHERITED =
GM;
166DEF_GM(
return new ModeColorFilterGM; )
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static sk_sp< SkShader > make_bg_shader()
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clear(SkColor color)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
SkString getName() const override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
static constexpr SkPoint kPts[kPtsCount]
static sk_sp< SkShader > make_solid_shader()
static sk_sp< SkShader > make_trans_black_shader()
static sk_sp< SkShader > make_transparent_shader()
static sk_sp< SkShader > make_color_shader(SkColor color)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)