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// HASH=918a9778c3d7d5cb306692784399f6dc
5REG_FIDDLE(Matrix_mapVectors, 256, 256, false, 0) {
6void 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
24