You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
487B

  1. #include "widget/SvgWidget.hpp"
  2. #include "app.hpp"
  3. namespace rack {
  4. namespace widget {
  5. void SvgWidget::wrap() {
  6. if (svg && svg->handle) {
  7. box.size = math::Vec(svg->handle->width, svg->handle->height);
  8. }
  9. else {
  10. box.size = math::Vec();
  11. }
  12. }
  13. void SvgWidget::setSvg(std::shared_ptr<Svg> svg) {
  14. this->svg = svg;
  15. wrap();
  16. }
  17. void SvgWidget::draw(const DrawContext &ctx) {
  18. if (svg && svg->handle) {
  19. svgDraw(ctx.vg, svg->handle);
  20. }
  21. }
  22. } // namespace widget
  23. } // namespace rack