Skip to content

Commit 07ebeec

Browse files
committed
Fix iOS pluginmode bug
1 parent ef2c82d commit 07ebeec

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Source/Canvas.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion)
633633
}
634634
}
635635
}
636+
636637
currentRenderArea = invalidRegion;
637638

638639
auto drawBorder = [this, nvg, zoom](bool const bg, bool const fg) {
@@ -802,6 +803,11 @@ void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion)
802803
if (objectsDistributeResizer)
803804
objectsDistributeResizer->render(nvg);
804805

806+
nvgBeginPath(nvg);
807+
nvgRect(nvg, invalidRegion.getX(), invalidRegion.getY(), invalidRegion.getWidth(), invalidRegion.getHeight());
808+
nvgFillColor(nvg, nvgRGBA(rand() & 255, rand() & 255, rand() & 255, 40));
809+
nvgFill(nvg);
810+
805811
nvgRestore(nvg);
806812

807813
// Draw scrollbars
@@ -815,9 +821,9 @@ void Canvas::renderAllObjects(NVGcontext* nvg, Rectangle<int> const area)
815821
for (auto* obj : objects) {
816822
{
817823
auto b = obj->getBounds();
818-
NVGScopedState scopedState(nvg);
819-
nvgTranslate(nvg, b.getX(), b.getY());
820824
if (b.intersects(area) && obj->isVisible()) {
825+
NVGScopedState scopedState(nvg);
826+
nvgTranslate(nvg, b.getX(), b.getY());
821827
obj->render(nvg);
822828
}
823829
}

Source/PluginMode.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,11 @@ class PluginMode final : public Component
189189
#endif
190190
nvgScissor(nvg, (getWidth() - (width * scale)) / 2, (getHeight() - (height * scale)) / 2, width * scale, height * scale);
191191

192+
nvgTranslate(nvg, 0, (isWindowFullscreen() ? 0 : -titlebarHeight));
192193
nvgScale(nvg, scale, scale);
193-
nvgTranslate(nvg, cnv->getX(), cnv->getY() - (isWindowFullscreen() ? 0 : 40) / scale);
194+
nvgTranslate(nvg, cnv->getX(), cnv->getY());
194195

195-
area /= scale;
196-
area = area.translated(cnv->canvasOrigin.x, cnv->canvasOrigin.y);
197-
198-
cnv->performRender(nvg, area);
196+
cnv->performRender(nvg, cnv->getLocalArea(this, area.translated(0, 40)));
199197
}
200198

201199
void closePluginMode()

0 commit comments

Comments
 (0)