epoger@google.com | ec3ed6a | 2011-07-28 14:26: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 | */ |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 7 | #include "gm.h" |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 8 | #include "SkColorFilter.h" |
| 9 | #include "SkMaskFilter.h" |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 10 | #include "SkPath.h" |
| 11 | #include "SkRegion.h" |
| 12 | #include "SkShader.h" |
| 13 | #include "SkUtils.h" |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 14 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 15 | |
| 16 | // effects |
| 17 | #include "SkGradientShader.h" |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 18 | #include "SkBlurDrawLooper.h" |
| 19 | |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 20 | static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) { |
| 21 | bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType)); |
junov@google.com | dbfac8a | 2012-12-06 21:47:40 +0000 | [diff] [blame] | 22 | bm->eraseColor(SK_ColorTRANSPARENT); |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 23 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 24 | SkCanvas canvas(*bm); |
| 25 | SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; |
| 26 | SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
| 27 | SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; |
| 28 | SkPaint paint; |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 29 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 30 | paint.setDither(true); |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 31 | paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos, SK_ARRAY_COUNT(colors), |
| 32 | SkShader::kClamp_TileMode)); |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 33 | canvas.drawPaint(paint); |
| 34 | } |
| 35 | |
| 36 | static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, |
| 37 | SkShader::TileMode tmx, SkShader::TileMode tmy) { |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 38 | paint->setShader(SkShader::MakeBitmapShader(bm, tmx, tmy)); |
reed | 93a1215 | 2015-03-16 10:08:34 -0700 | [diff] [blame] | 39 | paint->setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 40 | } |
| 41 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 42 | constexpr SkColorType gColorTypes[] = { |
commit-bot@chromium.org | 28fcae2 | 2014-04-11 17:15:40 +0000 | [diff] [blame] | 43 | kN32_SkColorType, |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 44 | kRGB_565_SkColorType, |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 45 | }; |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 46 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 47 | class TilingGM : public skiagm::GM { |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 48 | public: |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 49 | TilingGM(bool powerOfTwoSize) |
robertphillips@google.com | 6db2ae2 | 2013-08-30 12:41:42 +0000 | [diff] [blame] | 50 | : fPowerOfTwoSize(powerOfTwoSize) { |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 51 | } |
| 52 | |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 53 | SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 54 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 55 | protected: |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 56 | |
| 57 | enum { |
| 58 | kPOTSize = 32, |
| 59 | kNPOTSize = 21, |
| 60 | }; |
| 61 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 62 | SkString onShortName() override { |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 63 | SkString name("tilemodes"); |
| 64 | if (!fPowerOfTwoSize) { |
| 65 | name.append("_npot"); |
| 66 | } |
| 67 | return name; |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 68 | } |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 69 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 70 | SkISize onISize() override { return SkISize::Make(880, 560); } |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 71 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 72 | void onOnceBeforeDraw() override { |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 73 | int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 74 | for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) { |
| 75 | makebm(&fTexture[i], gColorTypes[i], size, size); |
reed@google.com | 7775d66 | 2012-11-27 15:15:58 +0000 | [diff] [blame] | 76 | } |
| 77 | } |
| 78 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 79 | void onDraw(SkCanvas* canvas) override { |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 80 | |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 81 | int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; |
| 82 | |
| 83 | SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) }; |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 84 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 85 | const char* gConfigNames[] = { "8888", "565", "4444" }; |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 86 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 87 | constexpr bool gFilters[] = { false, true }; |
| 88 | static const char* gFilterNames[] = { "point", "bilinear" }; |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 89 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 90 | constexpr SkShader::TileMode gModes[] = { |
| 91 | SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode }; |
| 92 | static const char* gModeNames[] = { "C", "R", "M" }; |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 93 | |
| 94 | SkScalar y = SkIntToScalar(24); |
| 95 | SkScalar x = SkIntToScalar(10); |
| 96 | |
| 97 | for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
| 98 | for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { |
| 99 | SkPaint p; |
| 100 | SkString str; |
| 101 | p.setAntiAlias(true); |
caryclark | 1818acb | 2015-07-24 12:09:25 -0700 | [diff] [blame] | 102 | sk_tool_utils::set_portable_typeface(&p); |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 103 | p.setDither(true); |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 104 | str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); |
| 105 | |
| 106 | p.setTextAlign(SkPaint::kCenter_Align); |
| 107 | canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 108 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 109 | x += r.width() * 4 / 3; |
| 110 | } |
| 111 | } |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 112 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 113 | y += SkIntToScalar(16); |
| 114 | |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 115 | for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) { |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 116 | for (size_t j = 0; j < SK_ARRAY_COUNT(gFilters); j++) { |
| 117 | x = SkIntToScalar(10); |
| 118 | for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
| 119 | for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { |
| 120 | SkPaint paint; |
bsalomon@google.com | ab3c678 | 2013-08-06 20:47:52 +0000 | [diff] [blame] | 121 | #if 1 // Temporary change to regen bitmap before each draw. This may help tracking down an issue |
| 122 | // on SGX where resizing NPOT textures to POT textures exhibits a driver bug. |
| 123 | if (!fPowerOfTwoSize) { |
commit-bot@chromium.org | dac5225 | 2014-02-17 21:21:46 +0000 | [diff] [blame] | 124 | makebm(&fTexture[i], gColorTypes[i], size, size); |
bsalomon@google.com | ab3c678 | 2013-08-06 20:47:52 +0000 | [diff] [blame] | 125 | } |
| 126 | #endif |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 127 | setup(&paint, fTexture[i], gFilters[j], gModes[kx], gModes[ky]); |
| 128 | paint.setDither(true); |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 129 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 130 | canvas->save(); |
| 131 | canvas->translate(x, y); |
| 132 | canvas->drawRect(r, paint); |
| 133 | canvas->restore(); |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 134 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 135 | x += r.width() * 4 / 3; |
| 136 | } |
| 137 | } |
| 138 | { |
| 139 | SkPaint p; |
| 140 | SkString str; |
| 141 | p.setAntiAlias(true); |
caryclark | 1818acb | 2015-07-24 12:09:25 -0700 | [diff] [blame] | 142 | sk_tool_utils::set_portable_typeface(&p); |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 143 | str.printf("%s, %s", gConfigNames[i], gFilterNames[j]); |
| 144 | canvas->drawText(str.c_str(), str.size(), x, y + r.height() * 2 / 3, p); |
| 145 | } |
| 146 | |
| 147 | y += r.height() * 4 / 3; |
| 148 | } |
| 149 | } |
| 150 | } |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 151 | |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 152 | private: |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 153 | bool fPowerOfTwoSize; |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 154 | typedef skiagm::GM INHERITED; |
| 155 | }; |
| 156 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 157 | constexpr int gWidth = 32; |
| 158 | constexpr int gHeight = 32; |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 159 | |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 160 | static sk_sp<SkShader> make_bm(SkShader::TileMode tx, SkShader::TileMode ty) { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 161 | SkBitmap bm; |
commit-bot@chromium.org | 28fcae2 | 2014-04-11 17:15:40 +0000 | [diff] [blame] | 162 | makebm(&bm, kN32_SkColorType, gWidth, gHeight); |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 163 | return SkShader::MakeBitmapShader(bm, tx, ty); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 164 | } |
| 165 | |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 166 | static sk_sp<SkShader> make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 167 | SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)} }; |
| 168 | SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 }; |
| 169 | SkScalar rad = SkIntToScalar(gWidth)/2; |
caryclark | 1e545b6 | 2015-07-13 08:19:58 -0700 | [diff] [blame] | 170 | SkColor colors[] = { 0xFFFF0000, sk_tool_utils::color_to_565(0xFF0044FF) }; |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 171 | |
| 172 | int index = (int)ty; |
| 173 | switch (index % 3) { |
| 174 | case 0: |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 175 | return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 176 | case 1: |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 177 | return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 178 | case 2: |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 179 | return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors)); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 180 | } |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 181 | return nullptr; |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 182 | } |
| 183 | |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 184 | typedef sk_sp<SkShader> (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 185 | |
| 186 | class Tiling2GM : public skiagm::GM { |
| 187 | ShaderProc fProc; |
| 188 | SkString fName; |
| 189 | public: |
| 190 | Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
| 191 | fName.printf("tilemode_%s", name); |
| 192 | } |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 193 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 194 | protected: |
commit-bot@chromium.org | a90c680 | 2014-04-30 13:20:45 +0000 | [diff] [blame] | 195 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 196 | SkString onShortName() override { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 197 | return fName; |
| 198 | } |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 199 | |
reed | 6dc14aa | 2016-04-11 07:46:38 -0700 | [diff] [blame] | 200 | SkISize onISize() override { return SkISize::Make(650, 610); } |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 201 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 202 | void onDraw(SkCanvas* canvas) override { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 203 | canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
| 204 | |
| 205 | const SkScalar w = SkIntToScalar(gWidth); |
| 206 | const SkScalar h = SkIntToScalar(gHeight); |
| 207 | SkRect r = { -w, -h, w*2, h*2 }; |
| 208 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 209 | constexpr SkShader::TileMode gModes[] = { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 210 | SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode |
| 211 | }; |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 212 | const char* gModeNames[] = { |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 213 | "Clamp", "Repeat", "Mirror" |
| 214 | }; |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 215 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 216 | SkScalar y = SkIntToScalar(24); |
| 217 | SkScalar x = SkIntToScalar(66); |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 218 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 219 | SkPaint p; |
| 220 | p.setAntiAlias(true); |
caryclark | 1818acb | 2015-07-24 12:09:25 -0700 | [diff] [blame] | 221 | sk_tool_utils::set_portable_typeface(&p); |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 222 | p.setTextAlign(SkPaint::kCenter_Align); |
| 223 | |
| 224 | for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
| 225 | SkString str(gModeNames[kx]); |
| 226 | canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); |
| 227 | x += r.width() * 4 / 3; |
| 228 | } |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 229 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 230 | y += SkIntToScalar(16) + h; |
| 231 | p.setTextAlign(SkPaint::kRight_Align); |
| 232 | |
| 233 | for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { |
| 234 | x = SkIntToScalar(16) + w; |
| 235 | |
| 236 | SkString str(gModeNames[ky]); |
| 237 | canvas->drawText(str.c_str(), str.size(), x, y + h/2, p); |
| 238 | |
| 239 | x += SkIntToScalar(50); |
| 240 | for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
| 241 | SkPaint paint; |
reed | 1a9b964 | 2016-03-13 14:13:58 -0700 | [diff] [blame] | 242 | paint.setShader(fProc(gModes[kx], gModes[ky])); |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 243 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 244 | canvas->save(); |
| 245 | canvas->translate(x, y); |
| 246 | canvas->drawRect(r, paint); |
| 247 | canvas->restore(); |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 248 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 249 | x += r.width() * 4 / 3; |
| 250 | } |
| 251 | y += r.height() * 4 / 3; |
| 252 | } |
| 253 | } |
skia.committer@gmail.com | 6a748ad | 2012-10-19 02:01:19 +0000 | [diff] [blame] | 254 | |
mike@reedtribe.org | a059169 | 2012-10-18 02:01:59 +0000 | [diff] [blame] | 255 | private: |
| 256 | typedef skiagm::GM INHERITED; |
reed@android.com | 1a2fec5 | 2009-06-22 02:17:34 +0000 | [diff] [blame] | 257 | }; |
| 258 | |
| 259 | ////////////////////////////////////////////////////////////////////////////// |
| 260 | |
commit-bot@chromium.org | 37799e1 | 2013-07-25 17:52:32 +0000 | [diff] [blame] | 261 | DEF_GM( return new TilingGM(true); ) |
| 262 | DEF_GM( return new TilingGM(false); ) |
reed@google.com | 3934200 | 2013-02-22 17:28:16 +0000 | [diff] [blame] | 263 | DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
| 264 | DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |