blob: fcacfcec5480f2893291a2eec060f360ad5701ec [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// 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 Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=918a9778c3d7d5cb306692784399f6dc
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Matrix_mapVectors, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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