Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | // Copyright 2019 Google LLC. |
| 2 | // 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] | 3 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 4 | // HASH=918a9778c3d7d5cb306692784399f6dc |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(Matrix_mapVectors, 256, 256, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 6 | void draw(SkCanvas* canvas) { |
| 7 | SkPaint paint; |
| 8 | paint.setAntiAlias(true); |
| 9 | paint.setStyle(SkPaint::kStroke_Style); |
| 10 | SkMatrix matrix; |
| 11 | matrix.reset(); |
| 12 | const SkVector radii[] = {{8, 4}, {9, 1}, {6, 2}, {7, 3}}; |
| 13 | for (int i = 0; i < 4; ++i) { |
| 14 | SkVector rScaled[4]; |
| 15 | matrix.preScale(1.5f, 2.f); |
| 16 | matrix.mapVectors(rScaled, radii, SK_ARRAY_COUNT(radii)); |
| 17 | SkRRect rrect; |
| 18 | rrect.setRectRadii({20, 20, 180, 70}, rScaled); |
| 19 | canvas->drawRRect(rrect, paint); |
| 20 | canvas->translate(0, 60); |
| 21 | } |
| 22 | } |
| 23 | } // END FIDDLE |