Browse Source

Set SVGPanel oversampling on every frame

tags/v0.5.0
Andrew Belt 8 years ago
parent
commit
41c66f1d8a
3 changed files with 12 additions and 6 deletions
  1. +1
    -1
      include/app.hpp
  2. +4
    -2
      src/app/SVGPanel.cpp
  3. +7
    -3
      src/gui.cpp

+ 1
- 1
include/app.hpp View File

@@ -155,7 +155,7 @@ struct Panel : TransparentWidget {
}; };


struct SVGPanel : FramebufferWidget { struct SVGPanel : FramebufferWidget {
SVGPanel();
void step() override;
void setBackground(std::shared_ptr<SVG> svg); void setBackground(std::shared_ptr<SVG> svg);
}; };




+ 4
- 2
src/app/SVGPanel.cpp View File

@@ -17,9 +17,11 @@ struct PanelBorder : TransparentWidget {
}; };




SVGPanel::SVGPanel() {
if (nearf(gPixelRatio, 1.0))
void SVGPanel::step() {
if (nearf(gPixelRatio, 1.0)) {
oversample = 2.0; oversample = 2.0;
}
FramebufferWidget::step();
} }


void SVGPanel::setBackground(std::shared_ptr<SVG> svg) { void SVGPanel::setBackground(std::shared_ptr<SVG> svg) {


+ 7
- 3
src/gui.cpp View File

@@ -218,9 +218,6 @@ void errorCallback(int error, const char *description) {
void renderGui() { void renderGui() {
int width, height; int width, height;
glfwGetFramebufferSize(gWindow, &width, &height); glfwGetFramebufferSize(gWindow, &width, &height);
int windowWidth, windowHeight;
glfwGetWindowSize(gWindow, &windowWidth, &windowHeight);
gPixelRatio = (float)width / windowWidth;


// Update and render // Update and render
nvgBeginFrame(gVg, width, height, gPixelRatio); nvgBeginFrame(gVg, width, height, gPixelRatio);
@@ -341,6 +338,13 @@ void guiRun() {
} }
glfwSetWindowTitle(gWindow, title.c_str()); glfwSetWindowTitle(gWindow, title.c_str());


// Get framebuffer size
int width, height;
glfwGetFramebufferSize(gWindow, &width, &height);
int windowWidth, windowHeight;
glfwGetWindowSize(gWindow, &windowWidth, &windowHeight);
gPixelRatio = (float)width / windowWidth;

// Step scene // Step scene
gScene->step(); gScene->step();




Loading…
Cancel
Save