blob: 1098fe4ed7b95b366faa93c58e846c2569ef40bc [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001#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 Kleinc0bd9f92019-04-23 12:05:21 -05004#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04005// HASH=68a5d24f22e2d798608fce8a20e47fd0
Hal Canarya7181e7c2019-03-18 16:06:34 -04006REG_FIDDLE(RRect_transform, 256, 110, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04007void draw(SkCanvas* canvas) {
8 SkVector radii[] = {{5, 5}, {10, 10}, {15, 15}, {5, 5}};
9 SkRRect rrect;
10 rrect.setRectRadii({10, 10, 110, 80}, radii);
11 SkRRect transformed;
12 SkMatrix matrix = SkMatrix::MakeRectToRect(rrect.rect(), {140, 30, 220, 80},
13 SkMatrix::kCenter_ScaleToFit);
14 bool success = rrect.transform(matrix, &transformed);
15 SkPaint paint;
16 paint.setAntiAlias(true);
17 canvas->drawString("rrect", 55, 100, paint);
18 canvas->drawString(success ? "transformed" : "transform failed", 185, 100, paint);
19 paint.setStyle(SkPaint::kStroke_Style);
20 canvas->drawRRect(rrect, paint);
21 canvas->drawRRect(transformed, paint);
22}
23} // END FIDDLE
24#endif // Disabled until updated to use current API.