• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 #include "tools/fiddle/examples.h"
5 // HASH=81345f7619a072bb2b0cf59810fe86d0
6 REG_FIDDLE(RRect_getSimpleRadii, 256, 100, false, 0) {
7 void draw(SkCanvas* canvas) {
8     auto drawDetails = [=](const SkRRect& rrect) {
9         SkPaint paint;
10         paint.setAntiAlias(true);
11         paint.setTextSize(12);
12         canvas->drawRRect(rrect, paint);
13         SkVector corner = rrect.getSimpleRadii();
14         std::string label = "corner: " + std::to_string(corner.fX).substr(0, 3) + ", " +
15                         std::to_string(corner.fY).substr(0, 3);
16         canvas->drawString(label.c_str(), 64, 90, paint);
17         canvas->translate(128, 0);
18     };
19     SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
20     drawDetails(rrect);
21     rrect.setRectXY(rrect.getBounds(), 5, 8);
22     drawDetails(rrect);
23 }
24 }  // END FIDDLE
25 #endif  // Disabled until updated to use current API.
26