Bug 949816 - Move override-EGLSurface feature out of GLContext - r=jgilbert

This commit is contained in:
Benoit Jacob 2014-01-02 10:17:28 -05:00
parent 62c75299c9
commit 277b7c507a
3 changed files with 16 additions and 17 deletions

View File

@ -2443,21 +2443,6 @@ public:
bool IsOwningThreadCurrent(); bool IsOwningThreadCurrent();
void DispatchToOwningThread(nsIRunnable *event); void DispatchToOwningThread(nsIRunnable *event);
/**
* Only on EGL.
*
* If surf is non-null, this sets it to temporarily override this context's
* primary surface. This makes this context current against this surface,
* and subsequent MakeCurrent calls will continue using this surface as long
* as this override is set.
*
* If surf is null, this removes any previously set override, and makes the
* context current again against its primary surface.
*/
virtual void SetEGLSurfaceOverride(EGLSurface surf) {
MOZ_CRASH("Must be called against a GLContextEGL.");
}
static void PlatformStartup(); static void PlatformStartup();
public: public:

View File

@ -409,7 +409,7 @@ public:
return true; return true;
} }
virtual void SetEGLSurfaceOverride(EGLSurface surf) MOZ_OVERRIDE { void SetEGLSurfaceOverride(EGLSurface surf) {
if (Screen()) { if (Screen()) {
/* Blit `draw` to `read` if we need to, before we potentially juggle /* Blit `draw` to `read` if we need to, before we potentially juggle
* `read` around. If we don't, we might attach a different `read`, * `read` around. If we don't, we might attach a different `read`,
@ -894,6 +894,16 @@ GLContextProviderEGL::Shutdown()
{ {
} }
GLContextEGL* DowncastGLContextEGL(GLContext* context)
{
return static_cast<GLContextEGL*>(context);
}
void SetEGLSurfaceOverride(GLContextEGL* context, EGLSurface surf)
{
context->SetEGLSurfaceOverride(surf);
}
} /* namespace gl */ } /* namespace gl */
} /* namespace mozilla */ } /* namespace mozilla */

View File

@ -12,6 +12,10 @@ using namespace mozilla::gfx;
namespace mozilla { namespace mozilla {
namespace gl { namespace gl {
class GLContextEGL;
void SetEGLSurfaceOverride(GLContextEGL* context, EGLSurface surf);
GLContextEGL* DowncastGLContextEGL(GLContext* context);
SurfaceFactory_ANGLEShareHandle* SurfaceFactory_ANGLEShareHandle*
SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl,
ID3D10Device1* d3d, ID3D10Device1* d3d,
@ -45,7 +49,7 @@ SharedSurface_ANGLEShareHandle::~SharedSurface_ANGLEShareHandle()
void void
SharedSurface_ANGLEShareHandle::LockProdImpl() SharedSurface_ANGLEShareHandle::LockProdImpl()
{ {
mGL->SetEGLSurfaceOverride(mPBuffer); SetEGLSurfaceOverride(DowncastGLContextEGL(mGL), mPBuffer);
} }
void void