Browse Source

Use Framebuffer for IconButton SVG

pull/1639/head
Andrew Belt 7 years ago
parent
commit
550e47096f
2 changed files with 8 additions and 1 deletions
  1. +1
    -0
      include/ui.hpp
  2. +7
    -1
      src/ui/IconButton.cpp

+ 1
- 0
include/ui.hpp View File

@@ -158,6 +158,7 @@ struct Button : OpaqueWidget {
};

struct IconButton : Button {
FramebufferWidget *fw;
SVGWidget *sw;
IconButton();
void setSVG(std::shared_ptr<SVG> svg);


+ 7
- 1
src/ui/IconButton.cpp View File

@@ -6,13 +6,19 @@ namespace rack {

IconButton::IconButton() {
box.size.x = BND_TOOL_WIDTH;

fw = new FramebufferWidget();
fw->oversample = 2;
addChild(fw);

sw = new SVGWidget();
sw->box.pos = Vec(2, 2);
addChild(sw);
fw->addChild(sw);
}

void IconButton::setSVG(std::shared_ptr<SVG> svg) {
sw->setSVG(svg);
fw->dirty = true;
}




Loading…
Cancel
Save