blob: f85c5a51d313d33ab8c2d7e2a7416c89accb6d78 [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001#if 0 // Disabled until updated to use current API.
2// Copyright 2019 Google LLC.
3// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05004#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04005// HASH=c851d1313e8909aaea4f0591699fdb7b
Hal Canarya7181e7c2019-03-18 16:06:34 -04006REG_FIDDLE(Matrix_setPolyToPoly, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04007void draw(SkCanvas* canvas) {
8 const SkPoint src[] = { { 0, 0}, {30, 0}, {30, -30}, { 0, -30} };
9 const SkPoint dst[] = { {50, 0}, {80, -10}, {90, -30}, {60, -40} };
10 SkPaint blackPaint;
11 blackPaint.setAntiAlias(true);
12 blackPaint.setTextSize(42);
13 SkPaint redPaint = blackPaint;
14 redPaint.setColor(SK_ColorRED);
15 for (int count : { 1, 2, 3, 4 } ) {
16 canvas->translate(35, 55);
17 for (int index = 0; index < count; ++index) {
18 canvas->drawCircle(src[index], 3, blackPaint);
19 canvas->drawCircle(dst[index], 3, blackPaint);
20 if (index > 0) {
21 canvas->drawLine(src[index], src[index - 1], blackPaint);
22 canvas->drawLine(dst[index], dst[index - 1], blackPaint);
23 }
24 }
25 SkMatrix matrix;
26 matrix.setPolyToPoly(src, dst, count);
27 canvas->drawString("A", src[0].fX, src[0].fY, redPaint);
28 SkAutoCanvasRestore acr(canvas, true);
29 canvas->concat(matrix);
30 canvas->drawString("A", src[0].fX, src[0].fY, redPaint);
31 }
32}
33} // END FIDDLE
34#endif // Disabled until updated to use current API.