diff options
Diffstat (limited to 'gfx/2d/MacIOSurface.h')
-rw-r--r-- | gfx/2d/MacIOSurface.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h index ef176430d1..d0ee3baeef 100644 --- a/gfx/2d/MacIOSurface.h +++ b/gfx/2d/MacIOSurface.h @@ -8,7 +8,7 @@ #define MacIOSurface_h__ #ifdef XP_DARWIN # include <CoreVideo/CoreVideo.h> -# include <IOSurface/IOSurface.h> +# include <IOSurface/IOSurfaceRef.h> # include <QuartzCore/QuartzCore.h> # include <dlfcn.h> @@ -21,20 +21,19 @@ class GLContext; } } // namespace mozilla +# ifdef XP_MACOSX struct _CGLContextObject; typedef _CGLContextObject* CGLContextObj; -typedef uint32_t IOSurfaceID; - -# ifdef XP_IOS -typedef kern_return_t IOReturn; -typedef int CGLError; # endif +typedef uint32_t IOSurfaceID; # ifdef XP_MACOSX # import <OpenGL/OpenGL.h> # else -# import <OpenGLES/ES2/gl.h> +# include "GLTypes.h" +typedef realGLboolean GLboolean; +# include <OpenGLES/ES2/gl.h> # endif # include "2D.h" @@ -123,15 +122,15 @@ class MacIOSurface final return mozilla::gfx::ColorRange::LIMITED; } - // 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( - mozilla::gl::GLContext* aGL, CGLContextObj ctxt, size_t plane, - mozilla::gfx::SurfaceFormat* aOutReadFormat = nullptr); - CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt, GLenum target, - GLenum internalFormat, GLsizei width, - GLsizei height, GLenum format, GLenum type, - GLuint plane) const; + // Bind this IOSurface to a texture using the most efficient mechanism + // available on the current platform. + // + // Note that on iOS simulator, due to incomplete support for + // texImageIOSurface, this will only use texImage2D to upload, and cannot be + // used to read-back the GL texture to an IOSurface. + bool BindTexImage(mozilla::gl::GLContext* aGL, size_t aPlane, + mozilla::gfx::SurfaceFormat* aOutReadFormat = nullptr); + already_AddRefed<SourceSurface> GetAsSurface(); // Creates a DrawTarget that wraps the data in the IOSurface. Rendering to |