blob: 6cdabefd2999de0ff33d422a37836918e0b43d31 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
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.com1a2fec52009-06-22 02:17:34 +00007
Ben Wagner7fde8e12019-05-01 17:28:53 -04008#include "gm/gm.h"
9#include "include/core/SkBitmap.h"
10#include "include/core/SkCanvas.h"
11#include "include/core/SkColor.h"
12#include "include/core/SkFilterQuality.h"
13#include "include/core/SkFont.h"
14#include "include/core/SkImage.h"
15#include "include/core/SkImageInfo.h"
16#include "include/core/SkPaint.h"
17#include "include/core/SkPoint.h"
18#include "include/core/SkRect.h"
19#include "include/core/SkRefCnt.h"
20#include "include/core/SkScalar.h"
21#include "include/core/SkShader.h"
22#include "include/core/SkSize.h"
23#include "include/core/SkString.h"
24#include "include/core/SkTileMode.h"
25#include "include/core/SkTypeface.h"
26#include "include/core/SkTypes.h"
27#include "include/effects/SkGradientShader.h"
28#include "include/utils/SkTextUtils.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050029#include "tools/Resources.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040030#include "tools/ToolUtils.h"
31
32#include <functional>
Mike Reeddfc0e912018-02-16 12:40:18 -050033
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +000034static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
35 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType));
junov@google.comdbfac8a2012-12-06 21:47:40 +000036 bm->eraseColor(SK_ColorTRANSPARENT);
rmistry@google.comae933ce2012-08-23 18:19:56 +000037
reed@android.com1a2fec52009-06-22 02:17:34 +000038 SkCanvas canvas(*bm);
39 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} };
40 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
41 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
42 SkPaint paint;
rmistry@google.comae933ce2012-08-23 18:19:56 +000043
reed@android.com1a2fec52009-06-22 02:17:34 +000044 paint.setDither(true);
reed1a9b9642016-03-13 14:13:58 -070045 paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos, SK_ARRAY_COUNT(colors),
Mike Reedfae8fce2019-04-03 10:27:45 -040046 SkTileMode::kClamp));
reed@android.com1a2fec52009-06-22 02:17:34 +000047 canvas.drawPaint(paint);
48}
49
50static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
Mike Reedfae8fce2019-04-03 10:27:45 -040051 SkTileMode tmx, SkTileMode tmy) {
Mike Reed50acf8f2019-04-08 13:20:23 -040052 paint->setShader(bm.makeShader(tmx, tmy));
reed93a12152015-03-16 10:08:34 -070053 paint->setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality);
reed@android.com1a2fec52009-06-22 02:17:34 +000054}
55
mtkleindbfd7ab2016-09-01 11:24:54 -070056constexpr SkColorType gColorTypes[] = {
commit-bot@chromium.org28fcae22014-04-11 17:15:40 +000057 kN32_SkColorType,
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +000058 kRGB_565_SkColorType,
reed@android.com1a2fec52009-06-22 02:17:34 +000059};
reed@android.com1a2fec52009-06-22 02:17:34 +000060
mike@reedtribe.orga0591692012-10-18 02:01:59 +000061class TilingGM : public skiagm::GM {
reed@android.com1a2fec52009-06-22 02:17:34 +000062public:
commit-bot@chromium.org37799e12013-07-25 17:52:32 +000063 TilingGM(bool powerOfTwoSize)
robertphillips@google.com6db2ae22013-08-30 12:41:42 +000064 : fPowerOfTwoSize(powerOfTwoSize) {
reed@android.com1a2fec52009-06-22 02:17:34 +000065 }
66
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +000067 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
rmistry@google.comae933ce2012-08-23 18:19:56 +000068
reed@android.com1a2fec52009-06-22 02:17:34 +000069protected:
commit-bot@chromium.org37799e12013-07-25 17:52:32 +000070
71 enum {
72 kPOTSize = 32,
73 kNPOTSize = 21,
74 };
75
mtklein36352bf2015-03-25 18:17:31 -070076 SkString onShortName() override {
commit-bot@chromium.org37799e12013-07-25 17:52:32 +000077 SkString name("tilemodes");
78 if (!fPowerOfTwoSize) {
79 name.append("_npot");
80 }
81 return name;
reed@android.com1a2fec52009-06-22 02:17:34 +000082 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000083
mtklein36352bf2015-03-25 18:17:31 -070084 SkISize onISize() override { return SkISize::Make(880, 560); }
rmistry@google.comae933ce2012-08-23 18:19:56 +000085
mtklein36352bf2015-03-25 18:17:31 -070086 void onOnceBeforeDraw() override {
commit-bot@chromium.org37799e12013-07-25 17:52:32 +000087 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +000088 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
89 makebm(&fTexture[i], gColorTypes[i], size, size);
reed@google.com7775d662012-11-27 15:15:58 +000090 }
91 }
92
mtklein36352bf2015-03-25 18:17:31 -070093 void onDraw(SkCanvas* canvas) override {
Hal Canarydf2d27e2019-01-08 09:38:02 -050094 SkPaint textPaint;
Mike Kleinea3f0142019-03-20 11:12:10 -050095 SkFont font(ToolUtils::create_portable_typeface(), 12);
rmistry@google.comae933ce2012-08-23 18:19:56 +000096
commit-bot@chromium.org37799e12013-07-25 17:52:32 +000097 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
98
99 SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) };
reed@android.com1a2fec52009-06-22 02:17:34 +0000100
mtkleindbfd7ab2016-09-01 11:24:54 -0700101 const char* gConfigNames[] = { "8888", "565", "4444" };
rmistry@google.comae933ce2012-08-23 18:19:56 +0000102
mtkleindbfd7ab2016-09-01 11:24:54 -0700103 constexpr bool gFilters[] = { false, true };
104 static const char* gFilterNames[] = { "point", "bilinear" };
rmistry@google.comae933ce2012-08-23 18:19:56 +0000105
Mike Reedfae8fce2019-04-03 10:27:45 -0400106 constexpr SkTileMode gModes[] = {
107 SkTileMode::kClamp, SkTileMode::kRepeat, SkTileMode::kMirror };
mtkleindbfd7ab2016-09-01 11:24:54 -0700108 static const char* gModeNames[] = { "C", "R", "M" };
reed@android.com1a2fec52009-06-22 02:17:34 +0000109
110 SkScalar y = SkIntToScalar(24);
111 SkScalar x = SkIntToScalar(10);
112
113 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
114 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
115 SkPaint p;
reed@android.com1a2fec52009-06-22 02:17:34 +0000116 p.setDither(true);
Mike Reeddc5863c2018-12-23 23:19:14 -0500117 SkString str;
Mike Kleinea3f0142019-03-20 11:12:10 -0500118 SkFont font(ToolUtils::create_portable_typeface());
reed@android.com1a2fec52009-06-22 02:17:34 +0000119 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
120
Mike Reeddc5863c2018-12-23 23:19:14 -0500121 SkTextUtils::DrawString(canvas, str.c_str(), x + r.width()/2, y, font, p,
Mike Reed3a42ec02018-10-30 12:53:21 -0400122 SkTextUtils::kCenter_Align);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000123
reed@android.com1a2fec52009-06-22 02:17:34 +0000124 x += r.width() * 4 / 3;
125 }
126 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000127
reed@android.com1a2fec52009-06-22 02:17:34 +0000128 y += SkIntToScalar(16);
129
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +0000130 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
reed@android.com1a2fec52009-06-22 02:17:34 +0000131 for (size_t j = 0; j < SK_ARRAY_COUNT(gFilters); j++) {
132 x = SkIntToScalar(10);
133 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
134 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
135 SkPaint paint;
bsalomon@google.comab3c6782013-08-06 20:47:52 +0000136#if 1 // Temporary change to regen bitmap before each draw. This may help tracking down an issue
137 // on SGX where resizing NPOT textures to POT textures exhibits a driver bug.
138 if (!fPowerOfTwoSize) {
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +0000139 makebm(&fTexture[i], gColorTypes[i], size, size);
bsalomon@google.comab3c6782013-08-06 20:47:52 +0000140 }
141#endif
reed@android.com1a2fec52009-06-22 02:17:34 +0000142 setup(&paint, fTexture[i], gFilters[j], gModes[kx], gModes[ky]);
143 paint.setDither(true);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000144
reed@android.com1a2fec52009-06-22 02:17:34 +0000145 canvas->save();
146 canvas->translate(x, y);
147 canvas->drawRect(r, paint);
148 canvas->restore();
rmistry@google.comae933ce2012-08-23 18:19:56 +0000149
reed@android.com1a2fec52009-06-22 02:17:34 +0000150 x += r.width() * 4 / 3;
151 }
152 }
Hal Canarydf2d27e2019-01-08 09:38:02 -0500153 canvas->drawString(SkStringPrintf("%s, %s", gConfigNames[i], gFilterNames[j]),
154 x, y + r.height() * 2 / 3, font, textPaint);
reed@android.com1a2fec52009-06-22 02:17:34 +0000155
156 y += r.height() * 4 / 3;
157 }
158 }
159 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000160
reed@android.com1a2fec52009-06-22 02:17:34 +0000161private:
commit-bot@chromium.org37799e12013-07-25 17:52:32 +0000162 bool fPowerOfTwoSize;
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000163 typedef skiagm::GM INHERITED;
164};
Mike Reeddfc0e912018-02-16 12:40:18 -0500165DEF_GM( return new TilingGM(true); )
166DEF_GM( return new TilingGM(false); )
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000167
mtkleindbfd7ab2016-09-01 11:24:54 -0700168constexpr int gWidth = 32;
169constexpr int gHeight = 32;
commit-bot@chromium.org37799e12013-07-25 17:52:32 +0000170
Mike Reedfae8fce2019-04-03 10:27:45 -0400171static sk_sp<SkShader> make_bm(SkTileMode tx, SkTileMode ty) {
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000172 SkBitmap bm;
commit-bot@chromium.org28fcae22014-04-11 17:15:40 +0000173 makebm(&bm, kN32_SkColorType, gWidth, gHeight);
Mike Reed50acf8f2019-04-08 13:20:23 -0400174 return bm.makeShader(tx, ty);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000175}
176
Mike Reedfae8fce2019-04-03 10:27:45 -0400177static sk_sp<SkShader> make_grad(SkTileMode tx, SkTileMode ty) {
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000178 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)} };
179 SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 };
180 SkScalar rad = SkIntToScalar(gWidth)/2;
Mike Kleinea3f0142019-03-20 11:12:10 -0500181 SkColor colors[] = {0xFFFF0000, ToolUtils::color_to_565(0xFF0044FF)};
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000182
183 int index = (int)ty;
184 switch (index % 3) {
185 case 0:
reed1a9b9642016-03-13 14:13:58 -0700186 return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000187 case 1:
reed1a9b9642016-03-13 14:13:58 -0700188 return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000189 case 2:
Florin Malita5a9a9812017-08-01 16:38:08 -0400190 return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr,
191 SK_ARRAY_COUNT(colors), tx, 135, 225, 0, nullptr);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000192 }
halcanary96fcdcc2015-08-27 07:41:13 -0700193 return nullptr;
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000194}
195
Mike Reedfae8fce2019-04-03 10:27:45 -0400196typedef sk_sp<SkShader> (*ShaderProc)(SkTileMode, SkTileMode);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000197
198class Tiling2GM : public skiagm::GM {
199 ShaderProc fProc;
200 SkString fName;
201public:
202 Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) {
203 fName.printf("tilemode_%s", name);
204 }
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000205
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000206protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +0000207
mtklein36352bf2015-03-25 18:17:31 -0700208 SkString onShortName() override {
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000209 return fName;
210 }
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000211
reed6dc14aa2016-04-11 07:46:38 -0700212 SkISize onISize() override { return SkISize::Make(650, 610); }
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000213
mtklein36352bf2015-03-25 18:17:31 -0700214 void onDraw(SkCanvas* canvas) override {
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000215 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2);
216
217 const SkScalar w = SkIntToScalar(gWidth);
218 const SkScalar h = SkIntToScalar(gHeight);
219 SkRect r = { -w, -h, w*2, h*2 };
220
Mike Reedfae8fce2019-04-03 10:27:45 -0400221 constexpr SkTileMode gModes[] = {
222 SkTileMode::kClamp, SkTileMode::kRepeat, SkTileMode::kMirror
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000223 };
mtkleindbfd7ab2016-09-01 11:24:54 -0700224 const char* gModeNames[] = {
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000225 "Clamp", "Repeat", "Mirror"
226 };
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000227
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000228 SkScalar y = SkIntToScalar(24);
229 SkScalar x = SkIntToScalar(66);
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000230
Mike Kleinea3f0142019-03-20 11:12:10 -0500231 SkFont font(ToolUtils::create_portable_typeface());
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000232
233 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
234 SkString str(gModeNames[kx]);
Mike Reeddc5863c2018-12-23 23:19:14 -0500235 SkTextUtils::DrawString(canvas, str.c_str(), x + r.width()/2, y, font, SkPaint(),
236 SkTextUtils::kCenter_Align);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000237 x += r.width() * 4 / 3;
238 }
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000239
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000240 y += SkIntToScalar(16) + h;
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000241
242 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
243 x = SkIntToScalar(16) + w;
244
245 SkString str(gModeNames[ky]);
Mike Reeddc5863c2018-12-23 23:19:14 -0500246 SkTextUtils::DrawString(canvas, str.c_str(), x, y + h/2, font, SkPaint(),
247 SkTextUtils::kRight_Align);
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000248
249 x += SkIntToScalar(50);
250 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
251 SkPaint paint;
reed1a9b9642016-03-13 14:13:58 -0700252 paint.setShader(fProc(gModes[kx], gModes[ky]));
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000253
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000254 canvas->save();
255 canvas->translate(x, y);
256 canvas->drawRect(r, paint);
257 canvas->restore();
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000258
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000259 x += r.width() * 4 / 3;
260 }
261 y += r.height() * 4 / 3;
262 }
263 }
skia.committer@gmail.com6a748ad2012-10-19 02:01:19 +0000264
mike@reedtribe.orga0591692012-10-18 02:01:59 +0000265private:
266 typedef skiagm::GM INHERITED;
reed@android.com1a2fec52009-06-22 02:17:34 +0000267};
reed@google.com39342002013-02-22 17:28:16 +0000268DEF_GM( return new Tiling2GM(make_bm, "bitmap"); )
269DEF_GM( return new Tiling2GM(make_grad, "gradient"); )
Mike Reeddfc0e912018-02-16 12:40:18 -0500270
271////////////////////
272
Michael Ludwigbe315a22018-12-17 09:50:51 -0500273DEF_SIMPLE_GM(tilemode_decal, canvas, 720, 1100) {
Mike Reeddfc0e912018-02-16 12:40:18 -0500274 auto img = GetResourceAsImage("images/mandrill_128.png");
275 SkPaint bgpaint;
276 bgpaint.setColor(SK_ColorYELLOW);
277
278 SkRect r = { -20, -20, img->width() + 20.0f, img->height() + 20.0f };
Michael Ludwigbe315a22018-12-17 09:50:51 -0500279 canvas->translate(45, 45);
Mike Reeddfc0e912018-02-16 12:40:18 -0500280
Mike Reedfae8fce2019-04-03 10:27:45 -0400281 std::function<void(SkPaint*, SkTileMode, SkTileMode)> shader_procs[] = {
282 [img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
Michael Ludwigbe315a22018-12-17 09:50:51 -0500283 // Test no filtering with decal mode
Mike Reeddfc0e912018-02-16 12:40:18 -0500284 paint->setShader(img->makeShader(tx, ty));
Michael Ludwigbe315a22018-12-17 09:50:51 -0500285 paint->setFilterQuality(kNone_SkFilterQuality);
286 },
Mike Reedfae8fce2019-04-03 10:27:45 -0400287 [img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
Michael Ludwigbe315a22018-12-17 09:50:51 -0500288 // Test bilerp approximation for decal mode (or clamp to border HW)
289 paint->setShader(img->makeShader(tx, ty));
290 paint->setFilterQuality(kLow_SkFilterQuality);
291 },
Mike Reedfae8fce2019-04-03 10:27:45 -0400292 [img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
Michael Ludwigbe315a22018-12-17 09:50:51 -0500293 // Test bicubic filter with decal mode
294 paint->setShader(img->makeShader(tx, ty));
295 paint->setFilterQuality(kHigh_SkFilterQuality);
Mike Reeddfc0e912018-02-16 12:40:18 -0500296 },
Mike Reedfae8fce2019-04-03 10:27:45 -0400297 [img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
Mike Reeddfc0e912018-02-16 12:40:18 -0500298 SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
299 const SkPoint pts[] = {{ 0, 0 }, {img->width()*1.0f, img->height()*1.0f }};
300 const SkScalar* pos = nullptr;
301 const int count = SK_ARRAY_COUNT(colors);
302 paint->setShader(SkGradientShader::MakeLinear(pts, colors, pos, count, tx));
303 },
Mike Reedfae8fce2019-04-03 10:27:45 -0400304 [img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
Mike Reeddfc0e912018-02-16 12:40:18 -0500305 SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
306 const SkScalar* pos = nullptr;
307 const int count = SK_ARRAY_COUNT(colors);
308 paint->setShader(SkGradientShader::MakeRadial({ img->width()*0.5f, img->width()*0.5f },
309 img->width()*0.5f, colors, pos, count, tx));
310 },
311 };
312
313 const struct XY {
Mike Reedfae8fce2019-04-03 10:27:45 -0400314 SkTileMode fX;
315 SkTileMode fY;
Mike Reeddfc0e912018-02-16 12:40:18 -0500316 } pairs[] = {
Mike Reedfae8fce2019-04-03 10:27:45 -0400317 { SkTileMode::kClamp, SkTileMode::kClamp },
318 { SkTileMode::kClamp, SkTileMode::kDecal },
319 { SkTileMode::kDecal, SkTileMode::kClamp },
320 { SkTileMode::kDecal, SkTileMode::kDecal },
Mike Reeddfc0e912018-02-16 12:40:18 -0500321 };
322 for (const auto& p : pairs) {
323 SkPaint paint;
324 canvas->save();
325 for (const auto& proc : shader_procs) {
Michael Ludwigbe315a22018-12-17 09:50:51 -0500326 canvas->save();
327 // Apply a slight rotation to highlight the differences between filtered and unfiltered
328 // decal edges
329 canvas->rotate(4);
Mike Reeddfc0e912018-02-16 12:40:18 -0500330 canvas->drawRect(r, bgpaint);
331 proc(&paint, p.fX, p.fY);
332 canvas->drawRect(r, paint);
Michael Ludwigbe315a22018-12-17 09:50:51 -0500333 canvas->restore();
Mike Reeddfc0e912018-02-16 12:40:18 -0500334 canvas->translate(0, r.height() + 20);
335 }
336 canvas->restore();
337 canvas->translate(r.width() + 10, 0);
338 }
339}
340