mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm.h" |
| 9 | #include "SkCanvas.h" |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 10 | #include "SkColorFilterImageFilter.h" |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 11 | #include "SkGradientShader.h" |
| 12 | #include "SkTableColorFilter.h" |
| 13 | |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 14 | static sk_sp<SkShader> make_shader0(int w, int h) { |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 15 | SkPoint pts[] = { {0, 0}, {SkIntToScalar(w), SkIntToScalar(h)} }; |
| 16 | SkColor colors[] = { |
| 17 | SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN, |
| 18 | SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE |
| 19 | }; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 20 | return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), |
| 21 | SkShader::kClamp_TileMode); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 22 | } |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 23 | static void make_bm0(SkBitmap* bm) { |
| 24 | int W = 120; |
| 25 | int H = 120; |
reed@google.com | eb9a46c | 2014-01-25 16:46:20 +0000 | [diff] [blame] | 26 | bm->allocN32Pixels(W, H); |
junov@google.com | dbfac8a | 2012-12-06 21:47:40 +0000 | [diff] [blame] | 27 | bm->eraseColor(SK_ColorTRANSPARENT); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 28 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 29 | SkCanvas canvas(*bm); |
| 30 | SkPaint paint; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 31 | paint.setShader(make_shader0(W, H)); |
reed | 5bd055c | 2015-03-01 19:16:38 -0800 | [diff] [blame] | 32 | canvas.drawPaint(paint); |
reed | b675a73 | 2015-03-01 18:00:47 -0800 | [diff] [blame] | 33 | } |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 34 | static sk_sp<SkShader> make_shader1(int w, int h) { |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 35 | SkScalar cx = SkIntToScalar(w)/2; |
| 36 | SkScalar cy = SkIntToScalar(h)/2; |
| 37 | SkColor colors[] = { |
| 38 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, |
| 39 | }; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 40 | return SkGradientShader::MakeRadial(SkPoint::Make(cx, cy), cx, colors, nullptr, |
| 41 | SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 42 | } |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 43 | static void make_bm1(SkBitmap* bm) { |
| 44 | int W = 120; |
| 45 | int H = 120; |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 46 | SkScalar cx = SkIntToScalar(W)/2; |
| 47 | SkScalar cy = SkIntToScalar(H)/2; |
reed@google.com | eb9a46c | 2014-01-25 16:46:20 +0000 | [diff] [blame] | 48 | bm->allocN32Pixels(W, H); |
junov@google.com | dbfac8a | 2012-12-06 21:47:40 +0000 | [diff] [blame] | 49 | bm->eraseColor(SK_ColorTRANSPARENT); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 50 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 51 | SkCanvas canvas(*bm); |
| 52 | SkPaint paint; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 53 | paint.setShader(make_shader1(W, H)); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 54 | paint.setAntiAlias(true); |
| 55 | canvas.drawCircle(cx, cy, cx, paint); |
| 56 | } |
| 57 | |
| 58 | static void make_table0(uint8_t table[]) { |
| 59 | for (int i = 0; i < 256; ++i) { |
| 60 | int n = i >> 5; |
| 61 | table[i] = (n << 5) | (n << 2) | (n >> 1); |
| 62 | } |
| 63 | } |
| 64 | static void make_table1(uint8_t table[]) { |
| 65 | for (int i = 0; i < 256; ++i) { |
| 66 | table[i] = i * i / 255; |
| 67 | } |
| 68 | } |
| 69 | static void make_table2(uint8_t table[]) { |
| 70 | for (int i = 0; i < 256; ++i) { |
| 71 | float fi = i / 255.0f; |
robertphillips@google.com | 6853e80 | 2012-04-16 15:50:18 +0000 | [diff] [blame] | 72 | table[i] = static_cast<uint8_t>(sqrtf(fi) * 255); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 73 | } |
| 74 | } |
| 75 | |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 76 | static sk_sp<SkColorFilter> make_null_cf() { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 77 | return nullptr; |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 78 | } |
| 79 | |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 80 | static sk_sp<SkColorFilter> make_cf0() { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 81 | uint8_t table[256]; make_table0(table); |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 82 | return SkTableColorFilter::Make(table); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 83 | } |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 84 | static sk_sp<SkColorFilter> make_cf1() { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 85 | uint8_t table[256]; make_table1(table); |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 86 | return SkTableColorFilter::Make(table); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 87 | } |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 88 | static sk_sp<SkColorFilter> make_cf2() { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 89 | uint8_t table[256]; make_table2(table); |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 90 | return SkTableColorFilter::Make(table); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 91 | } |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 92 | static sk_sp<SkColorFilter> make_cf3() { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 93 | uint8_t table0[256]; make_table0(table0); |
| 94 | uint8_t table1[256]; make_table1(table1); |
| 95 | uint8_t table2[256]; make_table2(table2); |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 96 | return SkTableColorFilter::MakeARGB(nullptr, table0, table1, table2); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | class TableColorFilterGM : public skiagm::GM { |
| 100 | public: |
| 101 | TableColorFilterGM() {} |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 102 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 103 | protected: |
| 104 | virtual SkString onShortName() { |
| 105 | return SkString("tablecolorfilter"); |
| 106 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 107 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 108 | virtual SkISize onISize() { |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 109 | return SkISize::Make(700, 1650); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 110 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 111 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 112 | virtual void onDraw(SkCanvas* canvas) { |
caryclark | 1259601 | 2015-07-29 05:27:47 -0700 | [diff] [blame] | 113 | canvas->drawColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 114 | canvas->translate(20, 20); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 115 | |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 116 | |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 117 | static sk_sp<SkColorFilter> (*gColorFilterMakers[])() = { |
| 118 | make_null_cf, make_cf0, make_cf1, make_cf2, make_cf3 |
| 119 | }; |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 120 | static void (*gBitmapMakers[])(SkBitmap*) = { make_bm0, make_bm1 }; |
| 121 | |
| 122 | // This test will be done once for each bitmap with the results stacked vertically. |
| 123 | // For a single bitmap the resulting image will be the following: |
| 124 | // - A first line with the original bitmap, followed by the image drawn once |
| 125 | // with each of the N color filters |
| 126 | // - N lines of the bitmap drawn N times, this will cover all N*N combinations of |
| 127 | // pair of color filters in order to test the collpsing of consecutive table |
| 128 | // color filters. |
| 129 | // |
| 130 | // Here is a graphical representation of the result for 2 bitmaps and 2 filters |
| 131 | // with the number corresponding to the number of filters the bitmap goes through: |
| 132 | // |
| 133 | // --bitmap1 |
| 134 | // 011 |
| 135 | // 22 |
| 136 | // 22 |
| 137 | // --bitmap2 |
| 138 | // 011 |
| 139 | // 22 |
| 140 | // 22 |
| 141 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 142 | SkScalar x = 0, y = 0; |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 143 | for (size_t bitmapMaker = 0; bitmapMaker < SK_ARRAY_COUNT(gBitmapMakers); ++bitmapMaker) { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 144 | SkBitmap bm; |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 145 | gBitmapMakers[bitmapMaker](&bm); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 146 | |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 147 | SkScalar xOffset = SkScalar(bm.width() * 9 / 8); |
| 148 | SkScalar yOffset = SkScalar(bm.height() * 9 / 8); |
| 149 | |
| 150 | // Draw the first element of the first line |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 151 | x = 0; |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 152 | SkPaint paint; |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 153 | canvas->drawBitmap(bm, x, y, &paint); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 154 | |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 155 | // Draws the rest of the first line for this bitmap |
| 156 | // each draw being at xOffset of the previous one |
| 157 | for (unsigned i = 1; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { |
| 158 | x += xOffset; |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 159 | paint.setColorFilter(gColorFilterMakers[i]()); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 160 | canvas->drawBitmap(bm, x, y, &paint); |
| 161 | } |
| 162 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 163 | paint.setColorFilter(nullptr); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 164 | |
| 165 | for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 166 | auto colorFilter1(gColorFilterMakers[i]()); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 167 | SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Create( |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 168 | colorFilter1.get(), nullptr, nullptr)); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 169 | |
| 170 | // Move down to the next line and draw it |
| 171 | // each draw being at xOffset of the previous one |
| 172 | y += yOffset; |
| 173 | x = 0; |
| 174 | for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j) { |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 175 | auto colorFilter2(gColorFilterMakers[j]()); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 176 | SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageFilter::Create( |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 177 | colorFilter2.get(), imageFilter1, nullptr)); |
cwallez | c12b74d | 2015-01-26 07:45:53 -0800 | [diff] [blame] | 178 | paint.setImageFilter(imageFilter2); |
| 179 | canvas->drawBitmap(bm, x, y, &paint); |
| 180 | x += xOffset; |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | // Move down one line to the beginning of the block for next bitmap |
| 185 | y += yOffset; |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 186 | } |
| 187 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 188 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 189 | private: |
| 190 | typedef GM INHERITED; |
| 191 | }; |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 192 | DEF_GM( return new TableColorFilterGM; ) |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 193 | |
| 194 | ////////////////////////////////////////////////////////////////////////////// |
| 195 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 196 | class ComposeColorFilterGM : public skiagm::GM { |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 197 | enum { |
| 198 | COLOR_COUNT = 3, |
| 199 | MODE_COUNT = 4, |
| 200 | }; |
| 201 | const SkColor* fColors; |
| 202 | const SkXfermode::Mode* fModes; |
| 203 | SkString fName; |
| 204 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 205 | public: |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 206 | ComposeColorFilterGM(const SkColor colors[], const SkXfermode::Mode modes[], |
| 207 | const char suffix[]) |
| 208 | : fColors(colors), fModes(modes) |
| 209 | { |
| 210 | fName.printf("colorcomposefilter_%s", suffix); |
| 211 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame^] | 212 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 213 | protected: |
| 214 | virtual SkString onShortName() { |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 215 | return fName; |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 216 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame^] | 217 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 218 | virtual SkISize onISize() { |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 219 | return SkISize::Make(790, 790); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | virtual void onDraw(SkCanvas* canvas) { |
| 223 | SkBitmap bm; |
| 224 | make_bm1(&bm); |
| 225 | |
caryclark | 1259601 | 2015-07-29 05:27:47 -0700 | [diff] [blame] | 226 | canvas->drawColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 227 | |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 228 | const int MODES = MODE_COUNT * COLOR_COUNT; |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 229 | sk_sp<SkColorFilter> filters[MODES]; |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 230 | int index = 0; |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 231 | for (int i = 0; i < MODE_COUNT; ++i) { |
| 232 | for (int j = 0; j < COLOR_COUNT; ++j) { |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 233 | filters[index++] = SkColorFilter::MakeModeFilter(fColors[j], fModes[i]); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 234 | } |
| 235 | } |
| 236 | |
| 237 | SkPaint paint; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 238 | paint.setShader(make_shader1(50, 50)); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 239 | SkRect r = SkRect::MakeWH(50, 50); |
| 240 | const SkScalar spacer = 10; |
| 241 | |
| 242 | canvas->translate(spacer, spacer); |
| 243 | |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 244 | canvas->drawRect(r, paint); // orig |
| 245 | |
| 246 | for (int i = 0; i < MODES; ++i) { |
| 247 | paint.setColorFilter(filters[i]); |
| 248 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 249 | canvas->save(); |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 250 | canvas->translate((i + 1) * (r.width() + spacer), 0); |
| 251 | canvas->drawRect(r, paint); |
| 252 | canvas->restore(); |
| 253 | |
| 254 | canvas->save(); |
| 255 | canvas->translate(0, (i + 1) * (r.width() + spacer)); |
| 256 | canvas->drawRect(r, paint); |
| 257 | canvas->restore(); |
| 258 | } |
| 259 | |
| 260 | canvas->translate(r.width() + spacer, r.width() + spacer); |
| 261 | |
| 262 | for (int y = 0; y < MODES; ++y) { |
| 263 | canvas->save(); |
| 264 | for (int x = 0; x < MODES; ++x) { |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 265 | paint.setColorFilter(SkColorFilter::MakeComposeFilter(filters[y], filters[x])); |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 266 | canvas->drawRect(r, paint); |
| 267 | canvas->translate(r.width() + spacer, 0); |
| 268 | } |
| 269 | canvas->restore(); |
| 270 | canvas->translate(0, r.height() + spacer); |
| 271 | } |
| 272 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame^] | 273 | |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 274 | private: |
| 275 | typedef GM INHERITED; |
| 276 | }; |
reed | db873d8 | 2015-03-01 19:53:47 -0800 | [diff] [blame] | 277 | |
reed | cff10b2 | 2015-03-03 06:41:45 -0800 | [diff] [blame] | 278 | const SkColor gColors0[] = { SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW }; |
| 279 | const SkXfermode::Mode gModes0[] = { |
| 280 | SkXfermode::kOverlay_Mode, |
| 281 | SkXfermode::kDarken_Mode, |
| 282 | SkXfermode::kColorBurn_Mode, |
| 283 | SkXfermode::kExclusion_Mode, |
| 284 | }; |
| 285 | DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); ) |
| 286 | |
| 287 | const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF }; |
| 288 | const SkXfermode::Mode gModes1[] = { |
| 289 | SkXfermode::kSrcOver_Mode, |
| 290 | SkXfermode::kXor_Mode, |
| 291 | SkXfermode::kDstOut_Mode, |
| 292 | SkXfermode::kSrcATop_Mode, |
| 293 | }; |
| 294 | DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); ) |