diff options
Diffstat (limited to 'gfx/layers/SurfacePoolCA.mm')
-rw-r--r-- | gfx/layers/SurfacePoolCA.mm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gfx/layers/SurfacePoolCA.mm b/gfx/layers/SurfacePoolCA.mm index 47b2663ed7..4e012350f0 100644 --- a/gfx/layers/SurfacePoolCA.mm +++ b/gfx/layers/SurfacePoolCA.mm @@ -6,6 +6,7 @@ #include "mozilla/layers/SurfacePoolCA.h" #import <CoreVideo/CVPixelBuffer.h> +#include <IOSurface/IOSurfaceTypes.h> #include <algorithm> #include <unordered_set> @@ -16,7 +17,12 @@ #include "mozilla/StaticMutex.h" #include "mozilla/StaticPrefs_gfx.h" -#include "GLContextCGL.h" +#ifdef XP_MACOSX +# include "GLContextCGL.h" +#else +# include "GLContextEAGL.h" +#endif + #include "MozFramebuffer.h" #include "ScopedGLHelpers.h" @@ -28,7 +34,11 @@ using gfx::IntRect; using gfx::IntRegion; using gfx::IntSize; using gl::GLContext; +#ifdef XP_MACOSX using gl::GLContextCGL; +#else +using gl::GLContextEAGL; +#endif /* static */ RefPtr<SurfacePool> SurfacePool::Create(size_t aPoolSizeLimit) { return new SurfacePoolCA(aPoolSizeLimit); @@ -306,8 +316,13 @@ Maybe<GLuint> SurfacePoolCA::LockedPool::GetFramebufferForSurface( "Framebuffer creation", GRAPHICS_TileAllocation, nsPrintfCString("%dx%d", entry.mSize.width, entry.mSize.height)); +#ifdef XP_MACOSX RefPtr<GLContextCGL> cgl = GLContextCGL::Cast(aGL); MOZ_RELEASE_ASSERT(cgl, "Unexpected GLContext type"); +#else + RefPtr<GLContextEAGL> eagl = GLContextEAGL::Cast(aGL); + MOZ_RELEASE_ASSERT(eagl, "Unexpected GLContext type"); +#endif if (!aGL->MakeCurrent()) { // Context may have been destroyed. @@ -318,10 +333,14 @@ Maybe<GLuint> SurfacePoolCA::LockedPool::GetFramebufferForSurface( { const gl::ScopedBindTexture bindTex(aGL, tex, LOCAL_GL_TEXTURE_RECTANGLE_ARB); +#ifdef XP_MACOSX CGLTexImageIOSurface2D(cgl->GetCGLContext(), LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_RGBA, entry.mSize.width, entry.mSize.height, LOCAL_GL_BGRA, LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, entry.mIOSurface.get(), 0); +#else + MOZ_CRASH("unimplemented"); +#endif } auto fb = |