зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1323799 - Enable creating a GLContextWGL with an OOP compositor widget. r=jrmuizel
MozReview-Commit-ID: J5DX852Kgoi
This commit is contained in:
Родитель
ae11d416ec
Коммит
fde3ae3631
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "mozilla/widget/CompositorWidget.h"
|
||||
#include "mozilla/widget/WinCompositorWidget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
@ -443,17 +444,9 @@ GLContextProviderWGL::CreateWrappingExisting(void*, void*)
|
|||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
|
||||
{
|
||||
return CreateForWindow(aCompositorWidget->RealWidget(),
|
||||
aCompositorWidget->GetCompositorOptions().UseWebRender(),
|
||||
aForceAccelerated);
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget,
|
||||
bool aWebRender,
|
||||
bool aForceAccelerated)
|
||||
CreateForWidget(HWND aHwnd,
|
||||
bool aWebRender,
|
||||
bool aForceAccelerated)
|
||||
{
|
||||
if (!sWGLLib.EnsureInitialized()) {
|
||||
return nullptr;
|
||||
|
@ -465,7 +458,7 @@ GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget,
|
|||
* wglCreateContext will fail.
|
||||
*/
|
||||
|
||||
HDC dc = (HDC)aWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
HDC dc = ::GetDC(aHwnd);
|
||||
|
||||
SetPixelFormat(dc, sWGLLib.GetWindowPixelFormat(), nullptr);
|
||||
HGLRC context;
|
||||
|
@ -498,6 +491,20 @@ GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget,
|
|||
return glContext.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
|
||||
{
|
||||
return CreateForWidget(aCompositorWidget->AsWindows()->GetHwnd(),
|
||||
aCompositorWidget->GetCompositorOptions().UseWebRender(),
|
||||
aForceAccelerated);
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget, bool aWebRender, bool aForceAccelerated)
|
||||
{
|
||||
return CreateForWidget((HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW), aWebRender, aForceAccelerated);
|
||||
}
|
||||
|
||||
static already_AddRefed<GLContextWGL>
|
||||
CreatePBufferOffscreenContext(CreateContextFlags flags, const IntSize& aSize)
|
||||
{
|
||||
|
|
|
@ -3515,13 +3515,8 @@ void* nsWindow::GetNativeData(uint32_t aDataType)
|
|||
case NS_NATIVE_SHAREABLE_WINDOW:
|
||||
return (void*) WinUtils::GetTopLevelHWND(mWnd);
|
||||
case NS_NATIVE_GRAPHIC:
|
||||
#ifdef MOZ_ENABLE_WEBRENDER
|
||||
// This might be a bad idea?
|
||||
return ::GetDC(mWnd);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("Not supported on Windows:");
|
||||
return nullptr;
|
||||
#endif
|
||||
case NS_RAW_NATIVE_IME_CONTEXT: {
|
||||
void* pseudoIMEContext = GetPseudoIMEContext();
|
||||
if (pseudoIMEContext) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче