1 #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.
4 #include "tools/fiddle/examples.h"
5 // HASH=c851d1313e8909aaea4f0591699fdb7b
6 REG_FIDDLE(Matrix_setPolyToPoly, 256, 256, false, 0) {
7 void 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} };
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);
21 canvas->drawLine(src[index], src[index - 1], blackPaint);
22 canvas->drawLine(dst[index], dst[index - 1], blackPaint);
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);
34 #endif // Disabled until updated to use current API.