Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 5 | // HASH=c851d1313e8909aaea4f0591699fdb7b |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(Matrix_setPolyToPoly, 256, 256, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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} }; |
| 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. |