blob: 368e3ead8c12f942ada0746941b2604d15f27537 [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 */
Mike Reedebfce6d2016-12-12 10:02:12 -05007
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
9#include "include/core/SkCanvas.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040010#include "include/core/SkClipOp.h"
11#include "include/core/SkColor.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050012#include "include/core/SkFont.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040013#include "include/core/SkFontTypes.h"
14#include "include/core/SkPaint.h"
Mike Reedd849a752020-09-08 20:47:09 -040015#include "include/core/SkPathBuilder.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040016#include "include/core/SkRect.h"
17#include "include/core/SkScalar.h"
18#include "include/core/SkSize.h"
19#include "include/core/SkString.h"
20#include "include/core/SkTypeface.h"
21#include "include/core/SkTypes.h"
Michael Ludwig49203842020-06-02 17:27:07 -040022#include "include/effects/SkGradientShader.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040023#include "src/core/SkClipOpPriv.h"
Mike Reed121c2af2020-03-10 14:02:56 -040024#include "tools/Resources.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050025#include "tools/ToolUtils.h"
bsalomon@google.com807cec42011-03-10 19:20:15 +000026
Ben Wagner7fde8e12019-05-01 17:28:53 -040027#include <string.h>
28
bsalomon@google.com807cec42011-03-10 19:20:15 +000029namespace skiagm {
30
mtkleindbfd7ab2016-09-01 11:24:54 -070031constexpr SkColor gPathColor = SK_ColorBLACK;
32constexpr SkColor gClipAColor = SK_ColorBLUE;
33constexpr SkColor gClipBColor = SK_ColorRED;
reed@google.coma8f60f22011-12-08 16:18:29 +000034
bsalomon@google.com807cec42011-03-10 19:20:15 +000035class ComplexClipGM : public GM {
36public:
bsalomon6ae83cf2014-12-17 14:38:49 -080037 ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw)
robertphillips@google.com50a69a02012-07-12 13:48:46 +000038 : fDoAAClip(aaclip)
bsalomon6ae83cf2014-12-17 14:38:49 -080039 , fDoSaveLayer(saveLayer)
40 , fInvertDraw(invertDraw) {
caryclarkceb9f3b2015-06-12 10:00:11 -070041 this->setBGColor(0xFFDEDFDE);
bsalomon@google.com807cec42011-03-10 19:20:15 +000042 }
43
44protected:
Mike Reedbc414ed2018-08-16 22:49:55 -040045 SkString onShortName() override {
reed@google.coma8f60f22011-12-08 16:18:29 +000046 SkString str;
bsalomon6ae83cf2014-12-17 14:38:49 -080047 str.printf("complexclip_%s%s%s",
robertphillips@google.com50a69a02012-07-12 13:48:46 +000048 fDoAAClip ? "aa" : "bw",
bsalomon6ae83cf2014-12-17 14:38:49 -080049 fDoSaveLayer ? "_layer" : "",
50 fInvertDraw ? "_invert" : "");
reed@google.coma8f60f22011-12-08 16:18:29 +000051 return str;
bsalomon@google.com807cec42011-03-10 19:20:15 +000052 }
53
Michael Ludwig9689e392020-05-05 10:56:42 -040054 SkISize onISize() override { return SkISize::Make(388, 780); }
bsalomon@google.com807cec42011-03-10 19:20:15 +000055
Mike Reedbc414ed2018-08-16 22:49:55 -040056 void onDraw(SkCanvas* canvas) override {
Mike Reedd849a752020-09-08 20:47:09 -040057 SkPath path = SkPathBuilder()
58 .moveTo(0, 50)
59 .quadTo(0, 0, 50, 0)
60 .lineTo(175, 0)
61 .quadTo(200, 0, 200, 25)
62 .lineTo(200, 150)
63 .quadTo(200, 200, 150, 200)
64 .lineTo(0, 200)
65 .close()
66 .moveTo(50, 50)
67 .lineTo(150, 50)
68 .lineTo(150, 125)
69 .quadTo(150, 150, 125, 150)
70 .lineTo(50, 150)
71 .close()
72 .detach();
bsalomon6ae83cf2014-12-17 14:38:49 -080073 if (fInvertDraw) {
Mike Reed7d34dc72019-11-26 12:17:17 -050074 path.setFillType(SkPathFillType::kInverseEvenOdd);
bsalomon6ae83cf2014-12-17 14:38:49 -080075 } else {
Mike Reed7d34dc72019-11-26 12:17:17 -050076 path.setFillType(SkPathFillType::kEvenOdd);
bsalomon6ae83cf2014-12-17 14:38:49 -080077 }
bsalomon@google.com807cec42011-03-10 19:20:15 +000078 SkPaint pathPaint;
79 pathPaint.setAntiAlias(true);
reed@google.coma8f60f22011-12-08 16:18:29 +000080 pathPaint.setColor(gPathColor);
bsalomon@google.com807cec42011-03-10 19:20:15 +000081
Mike Reedd849a752020-09-08 20:47:09 -040082 SkPath clipA = SkPath::Polygon({{10, 20}, {165, 22}, {70, 105}, {165, 177}, {-5, 180}}, true);
bsalomon@google.com807cec42011-03-10 19:20:15 +000083
Mike Reedd849a752020-09-08 20:47:09 -040084 SkPath clipB = SkPath::Polygon({{40, 10}, {190, 15}, {195, 190}, {40, 185}, {155, 100}}, true);
bsalomon@google.com807cec42011-03-10 19:20:15 +000085
Mike Kleinea3f0142019-03-20 11:12:10 -050086 SkFont font(ToolUtils::create_portable_typeface(), 20);
bsalomon@google.com807cec42011-03-10 19:20:15 +000087
mtkleindbfd7ab2016-09-01 11:24:54 -070088 constexpr struct {
Mike Reedc1f77742016-12-09 09:00:50 -050089 SkClipOp fOp;
reed73603f32016-09-20 08:42:38 -070090 const char* fName;
bsalomon@google.com807cec42011-03-10 19:20:15 +000091 } gOps[] = { //extra spaces in names for measureText
Mike Reedc1f77742016-12-09 09:00:50 -050092 {kIntersect_SkClipOp, "Isect "},
93 {kDifference_SkClipOp, "Diff " },
bsalomon@google.com807cec42011-03-10 19:20:15 +000094 };
95
Mike Reedbc414ed2018-08-16 22:49:55 -040096 canvas->translate(20, 20);
bsalomon@google.com807cec42011-03-10 19:20:15 +000097 canvas->scale(3 * SK_Scalar1 / 4, 3 * SK_Scalar1 / 4);
bsalomon@google.com807cec42011-03-10 19:20:15 +000098
robertphillips@google.com54bb7ab2012-07-13 14:55:25 +000099 if (fDoSaveLayer) {
100 // We want the layer to appear symmetric relative to actual
101 // device boundaries so we need to "undo" the effect of the
102 // scale and translate
103 SkRect bounds = SkRect::MakeLTRB(
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +0000104 4.0f/3.0f * -20,
105 4.0f/3.0f * -20,
106 4.0f/3.0f * (this->getISize().fWidth - 20),
107 4.0f/3.0f * (this->getISize().fHeight - 20));
robertphillips@google.com54bb7ab2012-07-13 14:55:25 +0000108
Mike Reedbc414ed2018-08-16 22:49:55 -0400109 bounds.inset(100, 100);
robertphillips@google.com50a69a02012-07-12 13:48:46 +0000110 SkPaint boundPaint;
111 boundPaint.setColor(SK_ColorRED);
112 boundPaint.setStyle(SkPaint::kStroke_Style);
113 canvas->drawRect(bounds, boundPaint);
Ben Wagner788a2dc2018-05-09 13:23:38 -0400114 canvas->clipRect(bounds);
halcanary96fcdcc2015-08-27 07:41:13 -0700115 canvas->saveLayer(&bounds, nullptr);
robertphillips@google.com50a69a02012-07-12 13:48:46 +0000116 }
117
reed@google.coma8f60f22011-12-08 16:18:29 +0000118 for (int invBits = 0; invBits < 4; ++invBits) {
119 canvas->save();
bsalomon@google.com807cec42011-03-10 19:20:15 +0000120 for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
reed@google.coma8f60f22011-12-08 16:18:29 +0000121 this->drawHairlines(canvas, path, clipA, clipB);
122
123 bool doInvA = SkToBool(invBits & 1);
124 bool doInvB = SkToBool(invBits & 2);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000125 canvas->save();
126 // set clip
Mike Reed7d34dc72019-11-26 12:17:17 -0500127 clipA.setFillType(doInvA ? SkPathFillType::kInverseEvenOdd :
128 SkPathFillType::kEvenOdd);
129 clipB.setFillType(doInvB ? SkPathFillType::kInverseEvenOdd :
130 SkPathFillType::kEvenOdd);
reed66998382016-09-21 11:15:07 -0700131 canvas->clipPath(clipA, fDoAAClip);
reed@google.coma8f60f22011-12-08 16:18:29 +0000132 canvas->clipPath(clipB, gOps[op].fOp, fDoAAClip);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000133
bsalomon6ae83cf2014-12-17 14:38:49 -0800134 // In the inverse case we need to prevent the draw from covering the whole
135 // canvas.
136 if (fInvertDraw) {
137 SkRect rectClip = clipA.getBounds();
138 rectClip.join(path.getBounds());
139 rectClip.join(path.getBounds());
140 rectClip.outset(5, 5);
141 canvas->clipRect(rectClip);
142 }
143
bsalomon@google.com807cec42011-03-10 19:20:15 +0000144 // draw path clipped
145 canvas->drawPath(path, pathPaint);
146 canvas->restore();
147
bsalomon@google.com807cec42011-03-10 19:20:15 +0000148
Mike Reed2e6db182018-12-15 13:45:33 -0500149 SkPaint paint;
Mike Reedbc414ed2018-08-16 22:49:55 -0400150 SkScalar txtX = 45;
reed@google.coma8f60f22011-12-08 16:18:29 +0000151 paint.setColor(gClipAColor);
152 const char* aTxt = doInvA ? "InvA " : "A ";
Ben Wagner51e15a62019-05-07 15:38:46 -0400153 canvas->drawSimpleText(aTxt, strlen(aTxt), SkTextEncoding::kUTF8, txtX, 220, font, paint);
154 txtX += font.measureText(aTxt, strlen(aTxt), SkTextEncoding::kUTF8);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000155 paint.setColor(SK_ColorBLACK);
Ben Wagner51e15a62019-05-07 15:38:46 -0400156 canvas->drawSimpleText(gOps[op].fName, strlen(gOps[op].fName), SkTextEncoding::kUTF8, txtX, 220,
Mike Reed2e6db182018-12-15 13:45:33 -0500157 font, paint);
Ben Wagner51e15a62019-05-07 15:38:46 -0400158 txtX += font.measureText(gOps[op].fName, strlen(gOps[op].fName), SkTextEncoding::kUTF8);
reed@google.coma8f60f22011-12-08 16:18:29 +0000159 paint.setColor(gClipBColor);
160 const char* bTxt = doInvB ? "InvB " : "B ";
Ben Wagner51e15a62019-05-07 15:38:46 -0400161 canvas->drawSimpleText(bTxt, strlen(bTxt), SkTextEncoding::kUTF8, txtX, 220, font, paint);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000162
Mike Reedbc414ed2018-08-16 22:49:55 -0400163 canvas->translate(250,0);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000164 }
reed@google.coma8f60f22011-12-08 16:18:29 +0000165 canvas->restore();
Mike Reedbc414ed2018-08-16 22:49:55 -0400166 canvas->translate(0, 250);
bsalomon@google.com807cec42011-03-10 19:20:15 +0000167 }
robertphillips@google.com50a69a02012-07-12 13:48:46 +0000168
robertphillips@google.com54bb7ab2012-07-13 14:55:25 +0000169 if (fDoSaveLayer) {
robertphillips@google.com50a69a02012-07-12 13:48:46 +0000170 canvas->restore();
171 }
bsalomon@google.com807cec42011-03-10 19:20:15 +0000172 }
173private:
reed@google.coma8f60f22011-12-08 16:18:29 +0000174 void drawHairlines(SkCanvas* canvas, const SkPath& path,
175 const SkPath& clipA, const SkPath& clipB) {
176 SkPaint paint;
177 paint.setAntiAlias(true);
178 paint.setStyle(SkPaint::kStroke_Style);
179 const SkAlpha fade = 0x33;
180
181 // draw path in hairline
182 paint.setColor(gPathColor); paint.setAlpha(fade);
183 canvas->drawPath(path, paint);
rmistry@google.comd6176b02012-08-23 18:14:13 +0000184
reed@google.coma8f60f22011-12-08 16:18:29 +0000185 // draw clips in hair line
186 paint.setColor(gClipAColor); paint.setAlpha(fade);
187 canvas->drawPath(clipA, paint);
188 paint.setColor(gClipBColor); paint.setAlpha(fade);
189 canvas->drawPath(clipB, paint);
190 }
191
bsalomon6ae83cf2014-12-17 14:38:49 -0800192 bool fDoAAClip;
193 bool fDoSaveLayer;
194 bool fInvertDraw;
195
John Stiles7571f9e2020-09-02 22:42:33 -0400196 using INHERITED = GM;
bsalomon@google.com807cec42011-03-10 19:20:15 +0000197};
198
199//////////////////////////////////////////////////////////////////////////////
200
halcanary385fe4d2015-08-26 13:07:48 -0700201DEF_GM(return new ComplexClipGM(false, false, false);)
202DEF_GM(return new ComplexClipGM(false, false, true);)
203DEF_GM(return new ComplexClipGM(false, true, false);)
204DEF_GM(return new ComplexClipGM(false, true, true);)
205DEF_GM(return new ComplexClipGM(true, false, false);)
206DEF_GM(return new ComplexClipGM(true, false, true);)
207DEF_GM(return new ComplexClipGM(true, true, false);)
208DEF_GM(return new ComplexClipGM(true, true, true);)
John Stilesa6841be2020-08-06 14:11:56 -0400209} // namespace skiagm
Mike Reed121c2af2020-03-10 14:02:56 -0400210
211DEF_SIMPLE_GM(clip_shader, canvas, 840, 650) {
212 auto img = GetResourceAsImage("images/yellow_rose.png");
213 auto sh = img->makeShader();
214
215 SkRect r = SkRect::MakeIWH(img->width(), img->height());
216 SkPaint p;
217
218 canvas->translate(10, 10);
219 canvas->drawImage(img, 0, 0, nullptr);
220
221 canvas->save();
222 canvas->translate(img->width() + 10, 0);
223 canvas->clipShader(sh, SkClipOp::kIntersect);
224 p.setColor(SK_ColorRED);
225 canvas->drawRect(r, p);
226 canvas->restore();
227
228 canvas->save();
229 canvas->translate(0, img->height() + 10);
230 canvas->clipShader(sh, SkClipOp::kDifference);
231 p.setColor(SK_ColorGREEN);
232 canvas->drawRect(r, p);
233 canvas->restore();
234
235 canvas->save();
236 canvas->translate(img->width() + 10, img->height() + 10);
237 canvas->clipShader(sh, SkClipOp::kIntersect);
238 canvas->save();
Mike Reed1f607332020-05-21 12:11:27 -0400239 SkMatrix lm = SkMatrix::Scale(1.0f/5, 1.0f/5);
Mike Reed121c2af2020-03-10 14:02:56 -0400240 canvas->clipShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, &lm));
241 canvas->drawImage(img, 0, 0, nullptr);
242
243 canvas->restore();
244 canvas->restore();
245}
Mike Reed84a9eb52020-03-12 13:55:44 -0400246
247DEF_SIMPLE_GM(clip_shader_layer, canvas, 430, 320) {
248 auto img = GetResourceAsImage("images/yellow_rose.png");
249 auto sh = img->makeShader();
250
251 SkRect r = SkRect::MakeIWH(img->width(), img->height());
252
253 canvas->translate(10, 10);
254 // now add the cool clip
255 canvas->clipRect(r);
256 canvas->clipShader(sh);
257 // now draw a layer with the same image, and watch it get restored w/ the clip
258 canvas->saveLayer(&r, nullptr);
259 canvas->drawColor(0xFFFF0000);
260 canvas->restore();
261}
Michael Ludwig49203842020-06-02 17:27:07 -0400262
263DEF_SIMPLE_GM(clip_shader_nested, canvas, 256, 256) {
264 float w = 64.f;
265 float h = 64.f;
266
267 const SkColor gradColors[] = {SK_ColorBLACK, SkColorSetARGB(128, 128, 128, 128)};
268 auto s = SkGradientShader::MakeRadial({0.5f * w, 0.5f * h}, 0.1f * w, gradColors, nullptr,
269 2, SkTileMode::kRepeat, 0, nullptr);
270
271 SkPaint p;
272
273 // A large black rect affected by two gradient clips
274 canvas->save();
275 canvas->clipShader(s);
276 canvas->scale(2.f, 2.f);
277 canvas->clipShader(s);
278 canvas->drawRect(SkRect::MakeWH(w, h), p);
279 canvas->restore();
280
281 canvas->translate(0.f, 2.f * h);
282
283 // A small red rect, with no clipping
284 canvas->save();
285 p.setColor(SK_ColorRED);
286 canvas->drawRect(SkRect::MakeWH(w, h), p);
287 canvas->restore();
288}
Michael Ludwig88b3b152020-06-03 10:22:49 -0400289
290namespace {
291
292// Where is canvas->concat(persp) called relative to the clipShader calls.
293enum ConcatPerspective {
294 kConcatBeforeClips,
295 kConcatAfterClips,
296 kConcatBetweenClips
297};
298// Order in which clipShader(image) and clipShader(gradient) are specified; only meaningful
299// when CanvasPerspective is kConcatBetweenClips.
300enum ClipOrder {
301 kClipImageFirst,
302 kClipGradientFirst,
303
304 kDoesntMatter = kClipImageFirst
305};
306// Which shaders have perspective applied as a local matrix.
307enum LocalMatrix {
308 kNoLocalMat,
309 kImageWithLocalMat,
310 kGradientWithLocalMat,
311 kBothWithLocalMat
312};
313struct Config {
314 ConcatPerspective fConcat;
315 ClipOrder fOrder;
316 LocalMatrix fLM;
317};
318
319static void draw_banner(SkCanvas* canvas, Config config) {
320 SkString banner;
321 banner.append("Persp: ");
322
323 if (config.fConcat == kConcatBeforeClips || config.fLM == kBothWithLocalMat) {
324 banner.append("Both Clips");
325 } else {
326 SkASSERT((config.fConcat == kConcatBetweenClips && config.fLM == kNoLocalMat) ||
327 (config.fConcat == kConcatAfterClips && (config.fLM == kImageWithLocalMat ||
328 config.fLM == kGradientWithLocalMat)));
329 if ((config.fConcat == kConcatBetweenClips && config.fOrder == kClipImageFirst) ||
330 config.fLM == kGradientWithLocalMat) {
331 banner.append("Gradient");
332 } else {
333 SkASSERT(config.fOrder == kClipGradientFirst || config.fLM == kImageWithLocalMat);
334 banner.append("Image");
335 }
336 }
337 if (config.fLM != kNoLocalMat) {
338 banner.append(" (w/ LM, should equal top row)");
339 }
340
341 static const SkFont kFont(ToolUtils::create_portable_typeface(), 12);
342 canvas->drawString(banner.c_str(), 20.f, -30.f, kFont, SkPaint());
343};
344
John Stilesa6841be2020-08-06 14:11:56 -0400345} // namespace
Michael Ludwig88b3b152020-06-03 10:22:49 -0400346
347DEF_SIMPLE_GM(clip_shader_persp, canvas, 1370, 1030) {
348 // Each draw has a clipShader(image-shader), a clipShader(gradient-shader), a concat(persp-mat),
349 // and each shader may or may not be wrapped with a perspective local matrix.
350
351 // Pairs of configs that should match in appearance where first config doesn't use a local
352 // matrix (top row of GM) and the second does (bottom row of GM).
353 Config matches[][2] = {
354 // Everything has perspective
355 {{kConcatBeforeClips, kDoesntMatter, kNoLocalMat},
356 {kConcatAfterClips, kDoesntMatter, kBothWithLocalMat}},
357 // Image shader has perspective
358 {{kConcatBetweenClips, kClipGradientFirst, kNoLocalMat},
359 {kConcatAfterClips, kDoesntMatter, kImageWithLocalMat}},
360 // Gradient shader has perspective
361 {{kConcatBetweenClips, kClipImageFirst, kNoLocalMat},
362 {kConcatAfterClips, kDoesntMatter, kGradientWithLocalMat}}
363 };
364
365 // The image that is drawn
366 auto img = GetResourceAsImage("images/yellow_rose.png");
367 // Scale factor always applied to the image shader so that it tiles
368 SkMatrix scale = SkMatrix::Scale(1.f / 4.f, 1.f / 4.f);
369 // The perspective matrix applied wherever needed
370 SkPoint src[4];
371 SkRect::Make(img->dimensions()).toQuad(src);
372 SkPoint dst[4] = {{0, 80.f},
373 {img->width() + 28.f, -100.f},
374 {img->width() - 28.f, img->height() + 100.f},
375 {0.f, img->height() - 80.f}};
376 SkMatrix persp;
377 SkAssertResult(persp.setPolyToPoly(src, dst, 4));
378
379 SkMatrix perspScale = SkMatrix::Concat(persp, scale);
380
381 auto drawConfig = [&](Config config) {
382 canvas->save();
383
384 draw_banner(canvas, config);
385
386 // Make clipShaders (possibly with local matrices)
387 bool gradLM = config.fLM == kGradientWithLocalMat || config.fLM == kBothWithLocalMat;
388 const SkColor gradColors[] = {SK_ColorBLACK, SkColorSetARGB(128, 128, 128, 128)};
389 auto gradShader = SkGradientShader::MakeRadial({0.5f * img->width(), 0.5f * img->height()},
390 0.1f * img->width(), gradColors, nullptr, 2,
391 SkTileMode::kRepeat, 0,
392 gradLM ? &persp : nullptr);
393 bool imageLM = config.fLM == kImageWithLocalMat || config.fLM == kBothWithLocalMat;
394 auto imgShader = img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
395 imageLM ? perspScale : scale);
396
397 // Perspective before any clipShader
398 if (config.fConcat == kConcatBeforeClips) {
399 canvas->concat(persp);
400 }
401
402 // First clipshader
403 canvas->clipShader(config.fOrder == kClipImageFirst ? imgShader : gradShader);
404
405 // Perspective between clipShader
406 if (config.fConcat == kConcatBetweenClips) {
407 canvas->concat(persp);
408 }
409
410 // Second clipShader
411 canvas->clipShader(config.fOrder == kClipImageFirst ? gradShader : imgShader);
412
413 // Perspective after clipShader
414 if (config.fConcat == kConcatAfterClips) {
415 canvas->concat(persp);
416 }
417
418 // Actual draw and clip boundary are the same for all configs
419 canvas->clipRect(SkRect::MakeIWH(img->width(), img->height()));
420 canvas->clear(SK_ColorBLACK);
421 canvas->drawImage(img, 0, 0);
422
423 canvas->restore();
424 };
425
426 SkIRect grid = persp.mapRect(SkRect::Make(img->dimensions())).roundOut();
427 grid.fLeft -= 20; // manual adjust to look nicer
428
429 canvas->translate(10.f, 10.f);
430
431 for (size_t i = 0; i < SK_ARRAY_COUNT(matches); ++i) {
432 canvas->save();
433 canvas->translate(-grid.fLeft, -grid.fTop);
434 drawConfig(matches[i][0]);
435 canvas->translate(0.f, grid.height());
436 drawConfig(matches[i][1]);
437 canvas->restore();
438
439 canvas->translate(grid.width(), 0.f);
440 }
441}