| 239 | } |
| 240 | |
| 241 | XYPathPtr XYPath::NewCustomPath(const fl::function<vec2f(float)> &f, |
| 242 | const rect<i16> &drawbounds, |
| 243 | const TransformFloat &transform, |
| 244 | const char *name) { |
| 245 | |
| 246 | XYPathFunctionPtr path = fl::make_shared<XYPathFunction>(f); |
| 247 | path->setName(name); |
| 248 | if (!drawbounds.empty()) { |
| 249 | path->setDrawBounds(drawbounds); |
| 250 | } |
| 251 | XYPathPtr out = fl::make_shared<XYPath>(path); |
| 252 | if (!transform.is_identity()) { |
| 253 | out->setTransform(transform); |
| 254 | } |
| 255 | rect<i16> bounds; |
| 256 | if (path->hasDrawBounds(&bounds)) { |
| 257 | if (!bounds.mMin.is_zero()) { |
| 258 | // Set the bounds to the path's bounds |
| 259 | FL_WARN( |
| 260 | "Bounds with an origin other than 0,0 is not supported yet"); |
| 261 | } |
| 262 | auto w = bounds.width(); |
| 263 | auto h = bounds.height(); |
| 264 | out->setDrawBounds(w, h); |
| 265 | } |
| 266 | return out; |
| 267 | } |
| 268 | |
| 269 | void XYPath::setTransform(const TransformFloat &transform) { |
| 270 | mPathRenderer->setTransform(transform); |
nothing calls this directly
no test coverage detected