Skip to content

Commit 74643cb

Browse files
author
alcomposer
committed
quickcanvas identifies itself when rendered
1 parent 859cd0a commit 74643cb

File tree

6 files changed

+17
-29
lines changed

6 files changed

+17
-29
lines changed

Source/Canvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ bool Canvas::updateFramebuffers(NVGcontext* nvg, Rectangle<int> invalidRegion)
603603
}
604604

605605
// Callback from canvasViewport to perform actual rendering
606-
void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion, bool isQuickCanvas) {
606+
void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion) {
607607
auto const halfSize = infiniteCanvasSize / 2;
608608
auto const zoom = getValue<float>(zoomScale);
609609
bool isLocked = getValue<bool>(locked);

Source/Canvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Canvas : public Component
9898
void focusLost(FocusChangeType cause) override;
9999

100100
bool updateFramebuffers(NVGcontext* nvg, Rectangle<int> invalidRegion);
101-
void performRender(NVGcontext* nvg, Rectangle<int> invalidRegion, bool isQuickCanvas = false);
101+
void performRender(NVGcontext* nvg, Rectangle<int> invalidRegion);
102102

103103
void resized() override;
104104

Source/CanvasViewport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ class CanvasViewport : public Viewport
489489

490490
cnv->quickCanvas->quickCanvasOffset = cnv->canvasOrigin - obj->getPosition().translated(Object::margin, Object::margin) + patch->getGraphBounds().getPosition();
491491

492+
cnv->quickCanvas->grabKeyboardFocus();
493+
492494
cnv->resized();
493495
}
494496
return;

Source/NVGSurface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ void NVGSurface::render()
416416
nvgViewport(0, 0, fbWidth, fbHeight);
417417
nvgBeginFrame(nvg, getWidth() * desktopScale, getHeight() * desktopScale, devicePixelScale);
418418
nvgScale(nvg, desktopScale, desktopScale);
419-
cnv->performRender(nvg, invalidArea, true);
419+
cnv->performRender(nvg, invalidArea);
420420
nvgGlobalScissor(nvg, invalidArea.getX() * pixelScale, invalidArea.getY() * pixelScale, invalidArea.getWidth() * pixelScale, invalidArea.getHeight() * pixelScale);
421421
nvgEndFrame(nvg);
422422

Source/TabComponent.cpp

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -578,32 +578,18 @@ SmallArray<Canvas*> TabComponent::getCanvases()
578578
return allCanvases;
579579
}
580580

581-
void TabComponent::renderArea(NVGcontext* nvg, Rectangle<int> area, bool isQuickCanvas)
581+
void TabComponent::renderArea(NVGcontext* nvg, Rectangle<int> area)
582582
{
583-
if (isQuickCanvas) {
584-
if (splits[0]) {
585-
NVGScopedState scopedState(nvg);
586-
nvgScissor(nvg, 0, 0, splits[1] ? (splitSize - 3) : getWidth(), getHeight());
587-
splits[0]->quickCanvas->performRender(nvg, area, true);
588-
}
589-
if (splits[1]) {
590-
NVGScopedState scopedState(nvg);
591-
nvgTranslate(nvg, splitSize + 3, 0);
592-
nvgScissor(nvg, 0, 0, getWidth() - (splitSize + 3), getHeight());
593-
splits[1]->quickCanvas->performRender(nvg, area.translated(-(splitSize + 3), 0), true);
594-
}
595-
} else {
596-
if (splits[0]) {
597-
NVGScopedState scopedState(nvg);
598-
nvgScissor(nvg, 0, 0, splits[1] ? (splitSize - 3) : getWidth(), getHeight());
599-
splits[0]->performRender(nvg, area);
600-
}
601-
if (splits[1]) {
602-
NVGScopedState scopedState(nvg);
603-
nvgTranslate(nvg, splitSize + 3, 0);
604-
nvgScissor(nvg, 0, 0, getWidth() - (splitSize + 3), getHeight());
605-
splits[1]->performRender(nvg, area.translated(-(splitSize + 3), 0));
606-
}
583+
if (splits[0]) {
584+
NVGScopedState scopedState(nvg);
585+
nvgScissor(nvg, 0, 0, splits[1] ? (splitSize - 3) : getWidth(), getHeight());
586+
splits[0]->performRender(nvg, area);
587+
}
588+
if (splits[1]) {
589+
NVGScopedState scopedState(nvg);
590+
nvgTranslate(nvg, splitSize + 3, 0);
591+
nvgScissor(nvg, 0, 0, getWidth() - (splitSize + 3), getHeight());
592+
splits[1]->performRender(nvg, area.translated(-(splitSize + 3), 0));
607593
}
608594

609595
if (!splitDropBounds.isEmpty()) {

Source/TabComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TabComponent : public Component
2424

2525
void openInPluginMode(pd::Patch::Ptr patch);
2626

27-
void renderArea(NVGcontext* nvg, Rectangle<int> bounds, bool isQuickCanvas = false);
27+
void renderArea(NVGcontext* nvg, Rectangle<int> bounds);
2828

2929
void nextTab();
3030
void previousTab();

0 commit comments

Comments
 (0)