| 51 | |
| 52 | template<typename T> |
| 53 | static void roundedRectangle(T& t, float x, float y, float width, float height, float rx_top_left, |
| 54 | float ry_top_left, float rx_top_right, float ry_top_right, |
| 55 | float rx_bottom_right, float ry_bottom_right, float rx_bottom_left, |
| 56 | float ry_bottom_left) { |
| 57 | float scale = 1.0f; |
| 58 | if (rx_top_left + rx_top_right) |
| 59 | scale = std::min(scale, width / (rx_top_left + rx_top_right)); |
| 60 | if (rx_bottom_left + rx_bottom_right) |
| 61 | scale = std::min(scale, width / (rx_bottom_left + rx_bottom_right)); |
| 62 | if (ry_top_left + ry_bottom_left) |
| 63 | scale = std::min(scale, height / (ry_top_left + ry_bottom_left)); |
| 64 | if (ry_top_right + ry_bottom_right) |
| 65 | scale = std::min(scale, height / (ry_top_right + ry_bottom_right)); |
| 66 | |
| 67 | rx_top_left *= scale; |
| 68 | ry_top_left *= scale; |
| 69 | rx_top_right *= scale; |
| 70 | ry_top_right *= scale; |
| 71 | rx_bottom_right *= scale; |
| 72 | ry_bottom_right *= scale; |
| 73 | rx_bottom_left *= scale; |
| 74 | ry_bottom_left *= scale; |
| 75 | |
| 76 | t.moveTo(x + rx_top_left, y); |
| 77 | t.lineTo(x + width - rx_top_right, y); |
| 78 | t.arcTo(rx_top_right, ry_top_right, 0.0f, false, true, Point(x + width, y + ry_top_right), false); |
| 79 | t.lineTo(x + width, y + height - ry_bottom_right); |
| 80 | t.arcTo(rx_bottom_right, ry_bottom_right, 0.0f, false, true, |
| 81 | Point(x + width - rx_bottom_right, y + height), false); |
| 82 | t.lineTo(x + rx_bottom_left, y + height); |
| 83 | t.arcTo(rx_bottom_left, ry_bottom_left, 0.0f, false, true, Point(x, y + height - ry_bottom_left), false); |
| 84 | t.lineTo(x, y + ry_top_left); |
| 85 | t.arcTo(rx_top_left, ry_top_left, 0.0f, false, true, Point(x + rx_top_left, y), false); |
| 86 | t.close(); |
| 87 | } |
| 88 | |
| 89 | template<typename T> |
| 90 | static void roundedRectangle(T& t, float x, float y, float width, float height, float rx, float ry) { |
no test coverage detected