blob: 12ff7cdc6761637513f5118f21448d8f57acc2e1 [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=a4233634c75b72fc7a2815ddb69bd669
Hal Canarya7181e7c2019-03-18 16:06:34 -04006REG_FIDDLE(RRect_Type, 256, 128, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04007void draw(SkCanvas* canvas) {
8 struct Radii { SkVector data[4]; };
9 auto drawRRectType = [=](const SkRect& rect, const Radii& radii) {
10 SkRRect rrect;
11 rrect.setRectRadii(rect, radii.data);
12 SkPaint paint;
13 paint.setAntiAlias(true);
14 const char* typeStr[] = { "empty", "rect", "oval", "simple", "nine patch", "complex" };
15 canvas->drawString(typeStr[(int) rrect.type()], rect.centerX(), rect.bottom() + 20, paint);
16 paint.setStyle(SkPaint::kStroke_Style);
17 canvas->drawRRect(rrect, paint);
18 };
19 drawRRectType({ 45, 30, 45, 30}, {{{ 5, 5}, { 5, 5}, { 5, 5}, { 5, 5}}});
20 drawRRectType({ 90, 10, 140, 30}, {{{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}}});
21 drawRRectType({160, 10, 210, 30}, {{{25, 10}, {25, 10}, {25, 10}, {25, 10}}});
22 drawRRectType({ 20, 80, 70, 100}, {{{ 5, 5}, { 5, 5}, { 5, 5}, { 5, 5}}});
23 drawRRectType({ 90, 80, 140, 100}, {{{ 5, 5}, {10, 5}, {10, 5}, { 5, 5}}});
24 drawRRectType({160, 80, 210, 100}, {{{ 5, 5}, {10, 5}, { 5, 5}, { 5, 5}}});
25}
26} // END FIDDLE
27#endif // Disabled until updated to use current API.