Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | #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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 5 | // HASH=a4233634c75b72fc7a2815ddb69bd669 |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(RRect_Type, 256, 128, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 7 | void 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. |