Browse Source

Fix slightly incorrect FramebufferWidget draw position when framebuffer is a different scale (e.g. before it gets a chance to re-render).

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
dd5fea40e9
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      src/widget/FramebufferWidget.cpp

+ 10
- 9
src/widget/FramebufferWidget.cpp View File

@@ -136,18 +136,19 @@ void FramebufferWidget::draw(const DrawArgs& args) {
// DEBUG("%f %f %f %f", scaleRatio.x, scaleRatio.y, offsetF.x, offsetF.y); // DEBUG("%f %f %f %f", scaleRatio.x, scaleRatio.y, offsetF.x, offsetF.y);


// DEBUG("%f %f %f %f, %f %f", RECT_ARGS(internal->fbBox), VEC_ARGS(internal->fbSize)); // DEBUG("%f %f %f %f, %f %f", RECT_ARGS(internal->fbBox), VEC_ARGS(internal->fbSize));
// DEBUG("offsetI (%f, %f) fbBox (%f, %f; %f, %f)", VEC_ARGS(offsetI), RECT_ARGS(internal->fbBox));
nvgBeginPath(args.vg); nvgBeginPath(args.vg);
nvgRect(args.vg, nvgRect(args.vg,
offsetI.x + internal->fbBox.pos.x,
offsetI.y + internal->fbBox.pos.y,
internal->fbBox.size.x * scaleRatio.x,
internal->fbBox.size.y * scaleRatio.y);
offsetI.x + internal->fbBox.pos.x * scaleRatio.x,
offsetI.y + internal->fbBox.pos.y * scaleRatio.y,
internal->fbBox.size.x * scaleRatio.x,
internal->fbBox.size.y * scaleRatio.y);
NVGpaint paint = nvgImagePattern(args.vg, NVGpaint paint = nvgImagePattern(args.vg,
offsetI.x + internal->fbBox.pos.x,
offsetI.y + internal->fbBox.pos.y,
internal->fbBox.size.x * scaleRatio.x,
internal->fbBox.size.y * scaleRatio.y,
0.0, internal->fb->image, 1.0);
offsetI.x + internal->fbBox.pos.x * scaleRatio.x,
offsetI.y + internal->fbBox.pos.y * scaleRatio.y,
internal->fbBox.size.x * scaleRatio.x,
internal->fbBox.size.y * scaleRatio.y,
0.0, internal->fb->image, 1.0);
nvgFillPaint(args.vg, paint); nvgFillPaint(args.vg, paint);
nvgFill(args.vg); nvgFill(args.vg);




Loading…
Cancel
Save