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