Bug 950903 - 6/8 - Remove GLContext::GetNativeData - r=jgilbert

This commit is contained in:
Benoit Jacob 2014-01-07 15:02:18 -05:00
parent df17e73e7c
commit ba93ad0ec2
16 changed files with 18 additions and 91 deletions

View File

@ -10,7 +10,7 @@
#include "nsNPAPIPluginInstance.h"
#include "nsPluginInstanceOwner.h"
#include "GLContextProvider.h"
#include "GLContext.h"
#include "GLContextEGL.h"
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
#define ASSIGN(obj, name) (obj)->name = anp_opengl_##name
@ -28,7 +28,7 @@ static ANPEGLContext anp_opengl_acquireContext(NPP instance) {
return nullptr;
context->MakeCurrent();
return context->GetNativeData(GLContext::NativeGLContext);
return GLContextEGL::Cast(context)->GetEGLContext();
}
static ANPTextureInfo anp_opengl_lockTexture(NPP instance) {

View File

@ -2425,15 +2425,6 @@ public:
return mSymbols.fUseProgram == nullptr;
}
enum NativeDataType {
NativeGLContext,
NativeImageSurface,
NativeThebesSurface,
NativeCGLContext,
NativeDataTypeMax
};
virtual void *GetNativeData(NativeDataType aType) { return nullptr; }
GLContext *GetSharedContext() { return mSharedContext; }
/**

View File

@ -43,8 +43,6 @@ public:
bool Init();
void *GetNativeData(NativeDataType aType);
NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
CGLContextObj GetCGLContext() const;

View File

@ -83,15 +83,13 @@ public:
bool SetupLookupFunction();
void *GetNativeData(NativeDataType aType);
bool SwapBuffers();
// hold a reference to the given surface
// for the lifetime of this context.
void HoldSurface(gfxASurface *aSurf);
EGLContext Context() {
EGLContext GetEGLContext() {
return mContext;
}

View File

@ -46,8 +46,6 @@ public:
bool SetupLookupFunction();
void *GetNativeData(NativeDataType aType);
bool IsDoubleBuffered();
bool SupportsRobustness();

View File

@ -118,19 +118,6 @@ GLContextCGL::Init()
return true;
}
void*
GLContextCGL::GetNativeData(NativeDataType aType)
{
switch (aType) {
case NativeGLContext:
return GetNSOpenGLContext();
case NativeCGLContext:
return GetCGLContext();
default:
return nullptr;
}
}
CGLContextObj
GLContextCGL::GetCGLContext() const
{

View File

@ -424,18 +424,6 @@ GLContextEGL::SetupLookupFunction()
return true;
}
void*
GLContextEGL::GetNativeData(NativeDataType aType)
{
switch (aType) {
case NativeGLContext:
return mContext;
default:
return nullptr;
}
}
bool
GLContextEGL::SwapBuffers()
{

View File

@ -897,21 +897,6 @@ GLContextGLX::SetupLookupFunction()
return true;
}
void*
GLContextGLX::GetNativeData(NativeDataType aType)
{
switch(aType) {
case NativeGLContext:
return mContext;
case NativeThebesSurface:
return mPixmap;
default:
return nullptr;
}
}
bool
GLContextGLX::IsDoubleBuffered()
{

View File

@ -380,20 +380,6 @@ GLContextWGL::SetupLookupFunction()
return true;
}
void*
GLContextWGL::GetNativeData(NativeDataType aType)
{
switch (aType) {
case NativeGLContext:
return mContext;
default:
return nullptr;
}
}
static bool
GetMaxSize(HDC hDC, int format, gfxIntSize& size, LibType aLibToUse)
{

View File

@ -62,8 +62,6 @@ public:
bool SetupLookupFunction();
void *GetNativeData(NativeDataType aType);
bool ResizeOffscreen(const gfx::IntSize& aNewSize);
HGLRC Context() { return mContext; }

View File

@ -2,8 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GLContext.h"
#include "GLLibraryEGL.h"
#include "GLContextEGL.h"
#include "GLSharedHandleHelpers.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsSurfaceTexture.h"
@ -75,7 +74,7 @@ public:
static const EGLint eglAttributes[] = {
LOCAL_EGL_NONE
};
EGLContext eglContext = (EGLContext)ctx->GetNativeData(GLContext::NativeGLContext);
EGLContext eglContext = GLContextEGL::Cast(ctx)->GetEGLContext();
mEGLImage = sEGLLibrary.fCreateImage(EGL_DISPLAY(), eglContext, LOCAL_EGL_GL_TEXTURE_2D,
(EGLClientBuffer)texture, eglAttributes);
if (!mEGLImage) {

View File

@ -5,7 +5,7 @@
#include "SharedSurfaceANGLE.h"
#include "GLContext.h"
#include "GLContextEGL.h"
using namespace mozilla::gfx;
@ -275,7 +275,7 @@ SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,
, mConsD3D(d3d)
{
mConfig = ChooseConfig(mProdGL, mEGL, mReadCaps);
mContext = mProdGL->GetNativeData(GLContext::NativeGLContext);
mContext = GLContextEGL::Cast(mProdGL)->GetEGLContext();
MOZ_ASSERT(mConfig && mContext);
}

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SharedSurfaceEGL.h"
#include "GLContext.h"
#include "GLContextEGL.h"
#include "GLBlitHelper.h"
#include "ScopedGLHelpers.h"
#include "SharedSurfaceGL.h"
@ -134,7 +134,7 @@ CreateTexturePipe(GLLibraryEGL* const egl, GLContext* const gl,
if (!tex)
return false;
EGLContext context = (EGLContext) gl->GetNativeData(GLContext::NativeGLContext);
EGLContext context = GLContextEGL::Cast(gl)->GetEGLContext();
MOZ_ASSERT(context);
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(tex);
EGLImage image = egl->fCreateImage(egl->Display(), context,
@ -287,7 +287,7 @@ SurfaceFactory_EGLImage*
SurfaceFactory_EGLImage::Create(GLContext* prodGL,
const SurfaceCaps& caps)
{
EGLContext context = prodGL->GetNativeData(GLContext::NativeGLContext);
EGLContext context = GLContextEGL::Cast(prodGL)->GetEGLContext();
return new SurfaceFactory_EGLImage(prodGL, context, caps);
}

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SharedSurfaceIO.h"
#include "GLContext.h"
#include "GLContextCGL.h"
#include "gfxImageSurface.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "mozilla/DebugOnly.h"
@ -80,7 +80,7 @@ SharedSurface_IOSurface::SharedSurface_IOSurface(MacIOSurface* surface,
LOCAL_GL_TEXTURE_WRAP_T,
LOCAL_GL_CLAMP_TO_EDGE);
CGLContextObj ctx = static_cast<CGLContextObj>(mGL->GetNativeData(GLContext::NativeCGLContext));
CGLContextObj ctx = GLContextCGL::Cast(mGL)->GetCGLContext();
MOZ_ASSERT(ctx);
surface->CGLTexImageIOSurface2D(ctx);

View File

@ -6,7 +6,7 @@
#include "MacIOSurfaceTextureHostOGL.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "mozilla/layers/CompositorOGL.h"
#include "GLContext.h"
#include "GLContextCGL.h"
namespace mozilla {
namespace layers {
@ -77,7 +77,7 @@ MacIOSurfaceTextureSourceOGL::BindTexture(GLenum aTextureUnit)
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, tex);
mSurface->CGLTexImageIOSurface2D(static_cast<CGLContextObj>(gl()->GetNativeData(gl::GLContext::NativeCGLContext)));
mSurface->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(gl())->GetCGLContext());
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
}

View File

@ -60,7 +60,7 @@
#include "mozilla/layers/LayerManagerComposite.h"
#include "GLTextureImage.h"
#include "GLContextProvider.h"
#include "GLContext.h"
#include "GLContextCGL.h"
#include "GLUploadHelpers.h"
#include "mozilla/layers/GLManager.h"
#include "mozilla/layers/CompositorOGL.h"
@ -353,8 +353,7 @@ public:
NSOpenGLContext* GetNSOpenGLContext()
{
return static_cast<NSOpenGLContext*>(
mGLContext->GetNativeData(GLContext::NativeGLContext));
return GLContextCGL::Cast(mGLContext)->GetNSOpenGLContext();
}
protected:
@ -2057,7 +2056,7 @@ nsChildView::PreRender(LayerManagerComposite* aManager)
// composition is done, thus keeping the GL context locked forever.
mViewTearDownLock.Lock();
NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext);
NSOpenGLContext *glContext = GLContextCGL::Cast(manager->gl())->GetNSOpenGLContext();
if (![(ChildView*)mView preRender:glContext]) {
mViewTearDownLock.Unlock();
@ -2073,7 +2072,7 @@ nsChildView::PostRender(LayerManagerComposite* aManager)
if (!manager) {
return;
}
NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext);
NSOpenGLContext *glContext = GLContextCGL::Cast(manager->gl())->GetNSOpenGLContext();
[(ChildView*)mView postRender:glContext];
mViewTearDownLock.Unlock();
}