mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 929471. Make CGLTexImageIOSurface2D take a CGLContextObj instead of a NSOpenGLContext. r=bgirard
This commit is contained in:
parent
3e0ab30703
commit
128a356ee1
@ -52,7 +52,7 @@ public:
|
||||
bool HasAlpha() { return mHasAlpha; }
|
||||
// We would like to forward declare NSOpenGLContext, but it is an @interface
|
||||
// and this file is also used from c++, so we use a void *.
|
||||
CGLError CGLTexImageIOSurface2D(void *ctxt);
|
||||
CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt);
|
||||
mozilla::TemporaryRef<SourceSurface> GetAsSurface();
|
||||
CGContextRef CreateIOSurfaceContext();
|
||||
|
||||
|
@ -444,10 +444,9 @@ MacIOSurface::GetAsSurface() {
|
||||
}
|
||||
|
||||
CGLError
|
||||
MacIOSurface::CGLTexImageIOSurface2D(void *c)
|
||||
MacIOSurface::CGLTexImageIOSurface2D(CGLContextObj ctxt)
|
||||
{
|
||||
NSOpenGLContext *ctxt = static_cast<NSOpenGLContext*>(c);
|
||||
return MacIOSurfaceLib::CGLTexImageIOSurface2D((CGLContextObj)[ctxt CGLContextObj],
|
||||
return MacIOSurfaceLib::CGLTexImageIOSurface2D(ctxt,
|
||||
GL_TEXTURE_RECTANGLE_ARB,
|
||||
HasAlpha() ? LOCAL_GL_RGBA : LOCAL_GL_RGB,
|
||||
GetDevicePixelWidth(),
|
||||
|
@ -2429,6 +2429,7 @@ public:
|
||||
NativeGLContext,
|
||||
NativeImageSurface,
|
||||
NativeThebesSurface,
|
||||
NativeCGLContext,
|
||||
NativeDataTypeMax
|
||||
};
|
||||
|
||||
|
@ -133,7 +133,8 @@ public:
|
||||
switch (aType) {
|
||||
case NativeGLContext:
|
||||
return mContext;
|
||||
|
||||
case NativeCGLContext:
|
||||
return [mContext CGLContextObj];
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -76,10 +76,10 @@ SharedSurface_IOSurface::SharedSurface_IOSurface(MacIOSurface* surface,
|
||||
LOCAL_GL_TEXTURE_WRAP_T,
|
||||
LOCAL_GL_CLAMP_TO_EDGE);
|
||||
|
||||
void *nativeCtx = mGL->GetNativeData(GLContext::NativeGLContext);
|
||||
MOZ_ASSERT(nativeCtx);
|
||||
CGLContextObj ctx = static_cast<CGLContextObj>(mGL->GetNativeData(GLContext::NativeCGLContext));
|
||||
MOZ_ASSERT(ctx);
|
||||
|
||||
surface->CGLTexImageIOSurface2D(nativeCtx);
|
||||
surface->CGLTexImageIOSurface2D(ctx);
|
||||
}
|
||||
|
||||
SharedSurface_IOSurface::~SharedSurface_IOSurface()
|
||||
|
@ -103,9 +103,8 @@ MakeIOSurfaceTexture(void* aCGIOSurfaceContext, mozilla::gl::GLContext* aGL)
|
||||
aGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
|
||||
RefPtr<MacIOSurface> ioSurface = MacIOSurface::IOSurfaceContextGetSurface((CGContextRef)aCGIOSurfaceContext);
|
||||
void *nativeCtx = aGL->GetNativeData(GLContext::NativeGLContext);
|
||||
|
||||
ioSurface->CGLTexImageIOSurface2D(nativeCtx);
|
||||
ioSurface->CGLTexImageIOSurface2D(static_cast<CGLContextObj>(aGL->GetNativeData(GLContext::NativeCGLContext)));
|
||||
|
||||
aGL->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
|
@ -482,8 +482,7 @@ MacIOSurfaceTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
||||
|
||||
gl()->fActiveTexture(aTextureUnit);
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, tex);
|
||||
void *nativeGL = gl()->GetNativeData(gl::GLContext::NativeGLContext);
|
||||
mSurface->CGLTexImageIOSurface2D(nativeGL);
|
||||
mSurface->CGLTexImageIOSurface2D(static_cast<CGLContextObj>(gl()->GetNativeData(GLContext::NativeCGLContext)));
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user