Browse Source

Fixes to allow OpenGL contexts to be attached to a top-level component.

tags/2021-05-28
jules 13 years ago
parent
commit
074a8c05dd
2 changed files with 10 additions and 9 deletions
  1. +8
    -8
      modules/juce_gui_basics/components/juce_Component.cpp
  2. +2
    -1
      modules/juce_opengl/native/juce_OpenGL_win32.h

+ 8
- 8
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -1810,6 +1810,14 @@ void Component::internalRepaintUnchecked (const Rectangle<int>& area, const bool
{
if (flags.visibleFlag)
{
if (cachedImage != nullptr)
{
if (isEntireComponent)
cachedImage->invalidateAll();
else
cachedImage->invalidate (area);
}
if (flags.hasHeavyweightPeerFlag)
{
// if component methods are being called from threads other than the message
@@ -1823,14 +1831,6 @@ void Component::internalRepaintUnchecked (const Rectangle<int>& area, const bool
}
else
{
if (cachedImage != nullptr)
{
if (isEntireComponent)
cachedImage->invalidateAll();
else
cachedImage->invalidate (area);
}
if (parentComponent != nullptr)
parentComponent->internalRepaint (ComponentHelpers::convertToParentSpace (*this, area));
}


+ 2
- 1
modules/juce_opengl/native/juce_OpenGL_win32.h View File

@@ -113,6 +113,7 @@ public:
unsigned int getFrameBufferID() const noexcept { return 0; }
private:
Component dummyComponent;
ScopedPointer<ComponentPeer> nativeWindow;
HGLRC renderContext;
HDC dc;
@@ -137,7 +138,7 @@ private:
void createNativeWindow (Component& component)
{
Component* topComp = component.getTopLevelComponent();
nativeWindow = createNonRepaintingEmbeddedWindowsPeer (&component, topComp->getWindowHandle());
nativeWindow = createNonRepaintingEmbeddedWindowsPeer (&dummyComponent, topComp->getWindowHandle());
updateWindowPosition (topComp->getLocalArea (&component, component.getLocalBounds()));
nativeWindow->setVisible (true);
dc = GetDC ((HWND) nativeWindow->getNativeHandle());


Loading…
Cancel
Save