From 49684e68a5f310d42ed6610f26927def3a710b74 Mon Sep 17 00:00:00 2001 From: JerryShih Date: Thu, 18 May 2017 22:59:06 +0800 Subject: [PATCH] Bug 1362049 - Remove the unused MacIOSurfaceTextureSourceOGL. r=mattwoodrow The MacIOSurfaceTextureSourceOGL doesn't be used in the codebase. MozReview-Commit-ID: EZ1fHw7J6YD --- .../opengl/MacIOSurfaceTextureHostOGL.cpp | 66 ------------------- .../opengl/MacIOSurfaceTextureHostOGL.h | 43 ------------ 2 files changed, 109 deletions(-) diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp index 98853f743eab..c7c7e20d850b 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp @@ -107,71 +107,5 @@ MacIOSurfaceTextureHostOGL::gl() const return mProvider ? mProvider->GetGLContext() : nullptr; } -MacIOSurfaceTextureSourceOGL::MacIOSurfaceTextureSourceOGL( - CompositorOGL* aCompositor, - MacIOSurface* aSurface) - : mCompositor(aCompositor) - , mSurface(aSurface) -{ - MOZ_ASSERT(aCompositor); - MOZ_COUNT_CTOR(MacIOSurfaceTextureSourceOGL); -} - -MacIOSurfaceTextureSourceOGL::~MacIOSurfaceTextureSourceOGL() -{ - MOZ_COUNT_DTOR(MacIOSurfaceTextureSourceOGL); -} - -gfx::IntSize -MacIOSurfaceTextureSourceOGL::GetSize() const -{ - return gfx::IntSize(mSurface->GetDevicePixelWidth(), - mSurface->GetDevicePixelHeight()); -} - -gfx::SurfaceFormat -MacIOSurfaceTextureSourceOGL::GetFormat() const -{ - return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8 - : gfx::SurfaceFormat::R8G8B8X8; -} - -void -MacIOSurfaceTextureSourceOGL::BindTexture(GLenum aTextureUnit, - gfx::SamplingFilter aSamplingFilter) -{ - gl::GLContext* gl = this->gl(); - if (!gl || !gl->MakeCurrent()) { - NS_WARNING("Trying to bind a texture without a working GLContext"); - return; - } - GLuint tex = mCompositor->GetTemporaryTexture(GetTextureTarget(), aTextureUnit); - - gl->fActiveTexture(aTextureUnit); - gl->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, tex); - mSurface->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(gl)->GetCGLContext()); - ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, LOCAL_GL_TEXTURE_RECTANGLE_ARB); -} - -void -MacIOSurfaceTextureSourceOGL::SetTextureSourceProvider(TextureSourceProvider* aProvider) -{ - CompositorOGL* ogl = nullptr; - if (Compositor* compositor = aProvider->AsCompositor()) { - ogl = compositor->AsCompositorOGL(); - } - - mCompositor = ogl; - if (mCompositor && mNextSibling) { - mNextSibling->SetTextureSourceProvider(aProvider); - } -} - -gl::GLContext* -MacIOSurfaceTextureSourceOGL::gl() const -{ - return mCompositor ? mCompositor->gl() : nullptr; -} - } // namespace layers } // namespace mozilla diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h index 939b5b46069a..20294ea0262a 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h @@ -14,49 +14,6 @@ class MacIOSurface; namespace mozilla { namespace layers { -/** - * A texture source meant for use with MacIOSurfaceTextureHostOGL. - * - * It does not own any GL texture, and attaches its shared handle to one of - * the compositor's temporary textures when binding. - */ -class MacIOSurfaceTextureSourceOGL : public TextureSource - , public TextureSourceOGL -{ -public: - MacIOSurfaceTextureSourceOGL(CompositorOGL* aCompositor, - MacIOSurface* aSurface); - virtual ~MacIOSurfaceTextureSourceOGL(); - - virtual const char* Name() const override { return "MacIOSurfaceTextureSourceOGL"; } - - virtual TextureSourceOGL* AsSourceOGL() override { return this; } - - virtual void BindTexture(GLenum activetex, - gfx::SamplingFilter aSamplingFilter) override; - - virtual bool IsValid() const override { return !!gl(); } - - virtual gfx::IntSize GetSize() const override; - - virtual gfx::SurfaceFormat GetFormat() const override; - - virtual GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_RECTANGLE_ARB; } - - virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } - - // MacIOSurfaceTextureSourceOGL doesn't own any gl texture - virtual void DeallocateDeviceData() override {} - - virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - - gl::GLContext* gl() const; - -protected: - RefPtr mCompositor; - RefPtr mSurface; -}; - /** * A TextureHost for shared MacIOSurface *