mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
OpenGL: Set OpenGL view position correctly after adjusting the global scale factor
This commit is contained in:
parent
c30b3a1a31
commit
7815d2007b
1 changed files with 12 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ public:
|
|||
void* contextToShare,
|
||||
bool shouldUseMultisampling,
|
||||
OpenGLVersion version)
|
||||
: owner (component)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attribs[64] = { 0 };
|
||||
createAttribs (attribs, version, pixFormat, shouldUseMultisampling);
|
||||
|
|
@ -188,7 +189,16 @@ public:
|
|||
lastSwapTime = now;
|
||||
}
|
||||
|
||||
void updateWindowPosition (Rectangle<int>) {}
|
||||
void updateWindowPosition (Rectangle<int>)
|
||||
{
|
||||
if (auto* peer = owner.getTopLevelComponent()->getPeer())
|
||||
{
|
||||
const auto newArea = peer->getAreaCoveredBy (owner);
|
||||
|
||||
if (convertToRectInt ([view frame]) != newArea)
|
||||
[view setFrame: makeNSRect (newArea)];
|
||||
}
|
||||
}
|
||||
|
||||
bool setSwapInterval (int numFramesPerSwapIn)
|
||||
{
|
||||
|
|
@ -237,6 +247,7 @@ public:
|
|||
return NSOpenGLCPSwapInterval;
|
||||
}
|
||||
|
||||
Component& owner;
|
||||
NSOpenGLContext* renderContext = nil;
|
||||
NSOpenGLView* view = nil;
|
||||
ReferenceCountedObjectPtr<ReferenceCountedObject> viewAttachment;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue