mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windowing: Reduce size of RenderContext interface
This commit is contained in:
parent
14f3751a06
commit
ce7bafcfcb
1 changed files with 17 additions and 23 deletions
|
|
@ -1445,7 +1445,6 @@ struct RenderContext
|
||||||
virtual const char* getName() const = 0;
|
virtual const char* getName() const = 0;
|
||||||
|
|
||||||
/* The following functions will all be called by the peer to update the state of the renderer. */
|
/* The following functions will all be called by the peer to update the state of the renderer. */
|
||||||
virtual void updateBorderSize() = 0;
|
|
||||||
virtual void setAlpha (float) = 0;
|
virtual void setAlpha (float) = 0;
|
||||||
virtual void handlePaintMessage() = 0;
|
virtual void handlePaintMessage() = 0;
|
||||||
virtual void repaint (const Rectangle<int>& area) = 0;
|
virtual void repaint (const Rectangle<int>& area) = 0;
|
||||||
|
|
@ -1454,8 +1453,8 @@ struct RenderContext
|
||||||
virtual void onVBlank() = 0;
|
virtual void onVBlank() = 0;
|
||||||
virtual void setResizing (bool) = 0;
|
virtual void setResizing (bool) = 0;
|
||||||
virtual bool getResizing() const = 0;
|
virtual bool getResizing() const = 0;
|
||||||
virtual void handleNcCalcSize (WPARAM wParam, LPARAM lParam) = 0;
|
|
||||||
virtual void handleShowWindow() = 0;
|
virtual void handleShowWindow() = 0;
|
||||||
|
virtual void setSize (int, int) = 0;
|
||||||
|
|
||||||
/* Gets a snapshot of whatever the render context is currently showing. */
|
/* Gets a snapshot of whatever the render context is currently showing. */
|
||||||
virtual Image createSnapshot() = 0;
|
virtual Image createSnapshot() = 0;
|
||||||
|
|
@ -1601,8 +1600,12 @@ public:
|
||||||
|
|
||||||
void updateBorderSize()
|
void updateBorderSize()
|
||||||
{
|
{
|
||||||
if (renderContext != nullptr)
|
if (renderContext == nullptr)
|
||||||
renderContext->updateBorderSize();
|
return;
|
||||||
|
|
||||||
|
RECT r;
|
||||||
|
GetClientRect (hwnd, &r);
|
||||||
|
renderContext->setSize (r.right - r.left, r.bottom - r.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBounds (const Rectangle<int>& bounds, bool isNowFullScreen) override
|
void setBounds (const Rectangle<int>& bounds, bool isNowFullScreen) override
|
||||||
|
|
@ -1797,8 +1800,7 @@ public:
|
||||||
constrainer->resizeEnd();
|
constrainer->resizeEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderContext != nullptr)
|
updateBorderSize();
|
||||||
renderContext->updateBorderSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFullScreen() const override
|
bool isFullScreen() const override
|
||||||
|
|
@ -3356,7 +3358,8 @@ private:
|
||||||
r = D2DUtilities::toRECT (modifiedPhysicalBounds);
|
r = D2DUtilities::toRECT (modifiedPhysicalBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBorderSize();
|
if (renderContext != nullptr)
|
||||||
|
renderContext->setSize (r.right - r.left, r.bottom - r.top);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -3851,8 +3854,10 @@ private:
|
||||||
|
|
||||||
case WM_NCCALCSIZE:
|
case WM_NCCALCSIZE:
|
||||||
{
|
{
|
||||||
|
auto* rect = (RECT*) lParam;
|
||||||
|
|
||||||
if (renderContext != nullptr)
|
if (renderContext != nullptr)
|
||||||
renderContext->handleNcCalcSize (wParam, lParam);
|
renderContext->setSize (rect->right - rect->left, rect->bottom - rect->top);
|
||||||
|
|
||||||
if (! wParam)
|
if (! wParam)
|
||||||
break;
|
break;
|
||||||
|
|
@ -4659,8 +4664,6 @@ public:
|
||||||
|
|
||||||
const char* getName() const override { return name; }
|
const char* getName() const override { return name; }
|
||||||
|
|
||||||
void updateBorderSize() override {}
|
|
||||||
|
|
||||||
void setAlpha (float newAlpha) override
|
void setAlpha (float newAlpha) override
|
||||||
{
|
{
|
||||||
auto intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f));
|
auto intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f));
|
||||||
|
|
@ -4756,11 +4759,11 @@ public:
|
||||||
return createGDISnapshotOfNativeWindow (peer.getHWND());
|
return createGDISnapshotOfNativeWindow (peer.getHWND());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSize (int, int) override {}
|
||||||
void onVBlank() override {}
|
void onVBlank() override {}
|
||||||
|
|
||||||
void setResizing (bool x) override { resizing = x; }
|
void setResizing (bool x) override { resizing = x; }
|
||||||
bool getResizing() const override { return resizing; }
|
bool getResizing() const override { return resizing; }
|
||||||
void handleNcCalcSize (WPARAM, LPARAM) override {}
|
|
||||||
void handleShowWindow() override {}
|
void handleShowWindow() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -4972,12 +4975,6 @@ public:
|
||||||
|
|
||||||
const char* getName() const override { return name; }
|
const char* getName() const override { return name; }
|
||||||
|
|
||||||
void updateBorderSize() override
|
|
||||||
{
|
|
||||||
if (peer.getComponent().isVisible())
|
|
||||||
direct2DContext->updateSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAlpha (float newAlpha) override
|
void setAlpha (float newAlpha) override
|
||||||
{
|
{
|
||||||
direct2DContext->setWindowAlpha (newAlpha);
|
direct2DContext->setWindowAlpha (newAlpha);
|
||||||
|
|
@ -5026,15 +5023,12 @@ public:
|
||||||
return direct2DContext->getResizing();
|
return direct2DContext->getResizing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleNcCalcSize (WPARAM, LPARAM lParam) override
|
void setSize (int w, int h) override
|
||||||
{
|
{
|
||||||
JUCE_TRACE_LOG_D2D_RESIZE (WM_NCCALCSIZE);
|
JUCE_TRACE_LOG_D2D_RESIZE (WM_NCCALCSIZE);
|
||||||
|
|
||||||
if (! peer.getComponent().isVisible())
|
if (peer.getComponent().isVisible())
|
||||||
return;
|
direct2DContext->setSize (w, h);
|
||||||
|
|
||||||
auto* rect = (RECT*) lParam;
|
|
||||||
direct2DContext->setSize (rect->right - rect->left, rect->bottom - rect->top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleShowWindow() override
|
void handleShowWindow() override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue