Browse Source

Increase dirtyOnSubpixelChange threshold to 0.1 px.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
5cb2341c85
2 changed files with 7 additions and 4 deletions
  1. +1
    -1
      include/common.hpp
  2. +6
    -3
      src/widget/FramebufferWidget.cpp

+ 1
- 1
include/common.hpp View File

@@ -30,7 +30,7 @@ E.g.
#endif #endif


/** Attribute for private functions and symbols not intended to be used by plugins. /** Attribute for private functions and symbols not intended to be used by plugins.
By default this does nothing, but when #including rack.hpp, it prints a compile-time warning.
When #including rack.hpp, using an INTERNAL function prints a compile-time warning and will not link.
*/ */
#if defined ARCH_WIN #if defined ARCH_WIN
#define INTERNAL #define INTERNAL


+ 6
- 3
src/widget/FramebufferWidget.cpp View File

@@ -185,9 +185,11 @@ void FramebufferWidget::draw(const DrawArgs& args) {
math::Vec offsetI = offset.floor(); math::Vec offsetI = offset.floor();
internal->offsetF = offset.minus(offsetI); internal->offsetF = offset.minus(offsetI);


if (dirtyOnSubpixelChange && !(math::isNear(internal->offsetF.x, internal->fbOffsetF.x, 0.01f) && math::isNear(internal->offsetF.y, internal->fbOffsetF.y, 0.01f))) {
// If drawing to a new subpixel location, rerender in the next frame.
// DEBUG("%p dirty subpixel", this);
// If drawing to a new subpixel location, rerender in the next frame.
// Anything less than 0.1 pixels isn't noticeable.
math::Vec offsetFDelta = internal->offsetF.minus(internal->fbOffsetF);
if (dirtyOnSubpixelChange && offsetFDelta.square() >= std::pow(0.1f, 2)) {
// DEBUG("%p dirty subpixel (%f, %f) (%f, %f)", this, VEC_ARGS(internal->offsetF), VEC_ARGS(internal->fbOffsetF));
setDirty(); setDirty();
} }
if (!internal->scale.equals(internal->fbScale)) { if (!internal->scale.equals(internal->fbScale)) {
@@ -247,6 +249,7 @@ void FramebufferWidget::drawFramebuffer() {
nvgTranslate(vg, internal->fbOffsetF.x, internal->fbOffsetF.y); nvgTranslate(vg, internal->fbOffsetF.x, internal->fbOffsetF.y);
nvgScale(vg, internal->fbScale.x, internal->fbScale.y); nvgScale(vg, internal->fbScale.x, internal->fbScale.y);


// Draw children
DrawArgs args; DrawArgs args;
args.vg = vg; args.vg = vg;
args.clipBox = box.zeroPos(); args.clipBox = box.zeroPos();


Loading…
Cancel
Save