From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- gfx/2d/MacIOSurface.h | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'gfx/2d/MacIOSurface.h') 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 -# include +# include # include # include @@ -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 # else -# import +# include "GLTypes.h" +typedef realGLboolean GLboolean; +# include # 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 GetAsSurface(); // Creates a DrawTarget that wraps the data in the IOSurface. Rendering to -- cgit v1.2.3