diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/cairo/cairo/src/moz.build | 4 | ||||
-rw-r--r-- | gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp | 107 | ||||
-rw-r--r-- | gfx/layers/basic/MacIOSurfaceTextureHostBasic.h | 97 | ||||
-rw-r--r-- | gfx/layers/ipc/ShadowLayerUtilsMac.cpp | 40 | ||||
-rw-r--r-- | gfx/layers/moz.build | 25 | ||||
-rw-r--r-- | gfx/layers/opengl/GLManager.cpp | 70 | ||||
-rw-r--r-- | gfx/layers/opengl/GLManager.h | 44 | ||||
-rw-r--r-- | gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp | 140 | ||||
-rw-r--r-- | gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h | 58 | ||||
-rw-r--r-- | gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp | 180 | ||||
-rw-r--r-- | gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h | 114 | ||||
-rwxr-xr-x | gfx/skia/generate_mozbuild.py | 3 | ||||
-rw-r--r-- | gfx/skia/moz.build | 3 |
13 files changed, 4 insertions, 881 deletions
diff --git a/gfx/cairo/cairo/src/moz.build b/gfx/cairo/cairo/src/moz.build index c5f936ad6b..6c81ce79a7 100644 --- a/gfx/cairo/cairo/src/moz.build +++ b/gfx/cairo/cairo/src/moz.build @@ -16,7 +16,7 @@ EXPORTS.cairo += [ 'pixman-rename.h', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('cocoa', 'uikit'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('uikit'): EXPORTS.cairo += [ 'cairo-pdf.h', ] @@ -56,7 +56,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': ] else: DEFINES['CAIRO_OMIT_WIN32_PRINTING'] = True -elif CONFIG['MOZ_WIDGET_TOOLKIT'] in {'cocoa', 'uikit'}: +elif CONFIG['MOZ_WIDGET_TOOLKIT'] in {'uikit'}: EXPORTS.cairo += [ 'cairo-quartz-image.h', 'cairo-quartz.h', diff --git a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp deleted file mode 100644 index 8834773e4c..0000000000 --- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "MacIOSurfaceTextureHostBasic.h" -#include "mozilla/gfx/MacIOSurface.h" -#include "MacIOSurfaceHelpers.h" - -namespace mozilla { -namespace layers { - -MacIOSurfaceTextureSourceBasic::MacIOSurfaceTextureSourceBasic( - BasicCompositor* aCompositor, - MacIOSurface* aSurface) - : mCompositor(aCompositor) - , mSurface(aSurface) -{ - MOZ_COUNT_CTOR(MacIOSurfaceTextureSourceBasic); -} - -MacIOSurfaceTextureSourceBasic::~MacIOSurfaceTextureSourceBasic() -{ - MOZ_COUNT_DTOR(MacIOSurfaceTextureSourceBasic); -} - -gfx::IntSize -MacIOSurfaceTextureSourceBasic::GetSize() const -{ - return gfx::IntSize(mSurface->GetDevicePixelWidth(), - mSurface->GetDevicePixelHeight()); -} - -gfx::SurfaceFormat -MacIOSurfaceTextureSourceBasic::GetFormat() const -{ - // Set the format the same way as CreateSourceSurfaceFromMacIOSurface. - return mSurface->GetFormat() == gfx::SurfaceFormat::NV12 - ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::B8G8R8A8; -} - -MacIOSurfaceTextureHostBasic::MacIOSurfaceTextureHostBasic( - TextureFlags aFlags, - const SurfaceDescriptorMacIOSurface& aDescriptor -) - : TextureHost(aFlags) -{ - mSurface = MacIOSurface::LookupSurface(aDescriptor.surfaceId(), - aDescriptor.scaleFactor(), - !aDescriptor.isOpaque()); -} - -gfx::SourceSurface* -MacIOSurfaceTextureSourceBasic::GetSurface(gfx::DrawTarget* aTarget) -{ - if (!mSourceSurface) { - mSourceSurface = CreateSourceSurfaceFromMacIOSurface(mSurface); - } - return mSourceSurface; -} - -void -MacIOSurfaceTextureSourceBasic::SetCompositor(Compositor* aCompositor) -{ - mCompositor = AssertBasicCompositor(aCompositor); -} - -bool -MacIOSurfaceTextureHostBasic::Lock() -{ - if (!mCompositor) { - return false; - } - - if (!mTextureSource) { - mTextureSource = new MacIOSurfaceTextureSourceBasic(mCompositor, mSurface); - } - return true; -} - -void -MacIOSurfaceTextureHostBasic::SetCompositor(Compositor* aCompositor) -{ - BasicCompositor* compositor = AssertBasicCompositor(aCompositor); - if (!compositor) { - mTextureSource = nullptr; - return; - } - mCompositor = compositor; - if (mTextureSource) { - mTextureSource->SetCompositor(compositor); - } -} - -gfx::SurfaceFormat -MacIOSurfaceTextureHostBasic::GetFormat() const { - return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8X8; -} - -gfx::IntSize -MacIOSurfaceTextureHostBasic::GetSize() const { - return gfx::IntSize(mSurface->GetDevicePixelWidth(), - mSurface->GetDevicePixelHeight()); -} - -} // namespace layers -} // namespace mozilla diff --git a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h deleted file mode 100644 index 7949aecfca..0000000000 --- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H -#define MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H - -#include "mozilla/layers/BasicCompositor.h" -#include "mozilla/layers/TextureHostBasic.h" - -class MacIOSurface; - -namespace mozilla { -namespace layers { - -class BasicCompositor; - -/** - * A texture source meant for use with BasicCompositor. - * - * It does not own any GL texture, and attaches its shared handle to one of - * the compositor's temporary textures when binding. - */ -class MacIOSurfaceTextureSourceBasic - : public TextureSourceBasic, - public TextureSource -{ -public: - MacIOSurfaceTextureSourceBasic(BasicCompositor* aCompositor, - MacIOSurface* aSurface); - virtual ~MacIOSurfaceTextureSourceBasic(); - - virtual const char* Name() const override { return "MacIOSurfaceTextureSourceBasic"; } - - virtual TextureSourceBasic* AsSourceBasic() override { return this; } - - virtual gfx::IntSize GetSize() const override; - virtual gfx::SurfaceFormat GetFormat() const override; - virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override; - - virtual void DeallocateDeviceData() override { } - - virtual void SetCompositor(Compositor* aCompositor) override; - -protected: - RefPtr<BasicCompositor> mCompositor; - RefPtr<MacIOSurface> mSurface; - RefPtr<gfx::SourceSurface> mSourceSurface; -}; - -/** - * A TextureHost for shared MacIOSurface - * - * Most of the logic actually happens in MacIOSurfaceTextureSourceBasic. - */ -class MacIOSurfaceTextureHostBasic : public TextureHost -{ -public: - MacIOSurfaceTextureHostBasic(TextureFlags aFlags, - const SurfaceDescriptorMacIOSurface& aDescriptor); - - virtual void SetCompositor(Compositor* aCompositor) override; - - virtual Compositor* GetCompositor() override { return mCompositor; } - - virtual bool Lock() override; - - virtual gfx::SurfaceFormat GetFormat() const override; - - virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override - { - aTexture = mTextureSource; - return !!aTexture; - } - - virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override - { - return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) - } - - virtual gfx::IntSize GetSize() const override; - -#ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "MacIOSurfaceTextureHostBasic"; } -#endif - -protected: - RefPtr<BasicCompositor> mCompositor; - RefPtr<MacIOSurfaceTextureSourceBasic> mTextureSource; - RefPtr<MacIOSurface> mSurface; -}; - -} // namespace layers -} // namespace mozilla - -#endif // MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_BASIC_H diff --git a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp b/gfx/layers/ipc/ShadowLayerUtilsMac.cpp deleted file mode 100644 index cc5199ea82..0000000000 --- a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=2 ts=8 et : - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/gfx/Point.h" -#include "mozilla/layers/PLayerTransaction.h" -#include "mozilla/layers/ShadowLayers.h" -#include "mozilla/layers/LayerManagerComposite.h" -#include "mozilla/layers/CompositorTypes.h" - -#include "gfx2DGlue.h" -#include "gfxPlatform.h" - -using namespace mozilla::gl; - -namespace mozilla { -namespace layers { - -/*static*/ void -ShadowLayerForwarder::PlatformSyncBeforeUpdate() -{ -} - -/*static*/ void -LayerManagerComposite::PlatformSyncBeforeReplyUpdate() -{ -} - -/*static*/ bool -LayerManagerComposite::SupportsDirectTexturing() -{ - return false; -} - - -} // namespace layers -} // namespace mozilla diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index f0fedf404c..e8da1af4d5 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -117,7 +117,6 @@ EXPORTS.mozilla.layers += [ 'AxisPhysicsModel.h', 'AxisPhysicsMSDModel.h', 'basic/BasicCompositor.h', - 'basic/MacIOSurfaceTextureHostBasic.h', 'basic/TextureHostBasic.h', 'BSPTree.h', 'BufferTexture.h', @@ -186,8 +185,6 @@ EXPORTS.mozilla.layers += [ 'LayersTypes.h', 'opengl/CompositingRenderTargetOGL.h', 'opengl/CompositorOGL.h', - 'opengl/MacIOSurfaceTextureClientOGL.h', - 'opengl/MacIOSurfaceTextureHostOGL.h', 'opengl/TextureClientOGL.h', 'opengl/TextureHostOGL.h', 'PersistentBufferProvider.h', @@ -213,21 +210,6 @@ if CONFIG['MOZ_X11']: 'opengl/X11TextureSourceOGL.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXPORTS.mozilla.layers += [ - 'opengl/GLManager.h', - ] - EXPORTS += [ - 'MacIOSurfaceHelpers.h', - 'MacIOSurfaceImage.h', - ] - SOURCES += [ - 'ipc/ShadowLayerUtilsMac.cpp', - 'MacIOSurfaceHelpers.cpp', - 'MacIOSurfaceImage.cpp', - 'opengl/GLManager.cpp', - ] - SOURCES += [ 'apz/public/IAPZCTreeManager.cpp', 'apz/src/APZCTreeManager.cpp', @@ -379,13 +361,6 @@ if CONFIG['_MSC_VER'] and CONFIG['CPU_ARCH'] == 'x86_64': ]: SOURCES[src].no_pgo = True -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'basic/MacIOSurfaceTextureHostBasic.cpp', - 'opengl/MacIOSurfaceTextureClientOGL.cpp', - 'opengl/MacIOSurfaceTextureHostOGL.cpp', - ] - IPDL_SOURCES = [ 'ipc/LayersMessages.ipdlh', 'ipc/LayersSurfaces.ipdlh', diff --git a/gfx/layers/opengl/GLManager.cpp b/gfx/layers/opengl/GLManager.cpp deleted file mode 100644 index e4c0b361fb..0000000000 --- a/gfx/layers/opengl/GLManager.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "GLManager.h" -#include "CompositorOGL.h" // for CompositorOGL -#include "GLContext.h" // for GLContext -#include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr -#include "mozilla/layers/Compositor.h" // for Compositor -#include "mozilla/layers/LayerManagerComposite.h" -#include "mozilla/layers/LayersTypes.h" -#include "mozilla/mozalloc.h" // for operator new, etc - -using namespace mozilla::gl; - -namespace mozilla { -namespace layers { - -class GLManagerCompositor : public GLManager -{ -public: - explicit GLManagerCompositor(CompositorOGL* aCompositor) - : mImpl(aCompositor) - {} - - virtual GLContext* gl() const override - { - return mImpl->gl(); - } - - virtual void ActivateProgram(ShaderProgramOGL *aProg) override - { - mImpl->ActivateProgram(aProg); - } - - virtual ShaderProgramOGL* GetProgram(GLenum aTarget, gfx::SurfaceFormat aFormat) override - { - ShaderConfigOGL config = ShaderConfigFromTargetAndFormat(aTarget, aFormat); - return mImpl->GetShaderProgramFor(config); - } - - virtual const gfx::Matrix4x4& GetProjMatrix() const override - { - return mImpl->GetProjMatrix(); - } - - virtual void BindAndDrawQuad(ShaderProgramOGL *aProg, - const gfx::Rect& aLayerRect, - const gfx::Rect& aTextureRect) override - { - mImpl->BindAndDrawQuad(aProg, aLayerRect, aTextureRect); - } - -private: - RefPtr<CompositorOGL> mImpl; -}; - -/* static */ GLManager* -GLManager::CreateGLManager(LayerManagerComposite* aManager) -{ - if (aManager && aManager->GetCompositor()->GetBackendType() == LayersBackend::LAYERS_OPENGL) { - return new GLManagerCompositor(aManager->GetCompositor()->AsCompositorOGL()); - } - return nullptr; -} - -} // namespace layers -} // namespace mozilla diff --git a/gfx/layers/opengl/GLManager.h b/gfx/layers/opengl/GLManager.h deleted file mode 100644 index 7c872758e9..0000000000 --- a/gfx/layers/opengl/GLManager.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef MOZILLA_GFX_GLMANAGER_H -#define MOZILLA_GFX_GLMANAGER_H - -#include "mozilla/gfx/Types.h" // for SurfaceFormat -#include "OGLShaderProgram.h" - -namespace mozilla { -namespace gl { -class GLContext; -} // namespace gl - -namespace layers { - -class LayerManagerComposite; - -/** - * Minimal interface to allow widgets to draw using OpenGL. Abstracts - * CompositorOGL. Call CreateGLManager with a LayerManagerComposite - * backed by a CompositorOGL. - */ -class GLManager -{ -public: - static GLManager* CreateGLManager(LayerManagerComposite* aManager); - - virtual ~GLManager() {} - - virtual gl::GLContext* gl() const = 0; - virtual ShaderProgramOGL* GetProgram(GLenum aTarget, gfx::SurfaceFormat aFormat) = 0; - virtual void ActivateProgram(ShaderProgramOGL* aPrg) = 0; - virtual const gfx::Matrix4x4& GetProjMatrix() const = 0; - virtual void BindAndDrawQuad(ShaderProgramOGL *aProg, const gfx::Rect& aLayerRect, - const gfx::Rect& aTextureRect) = 0; -}; - -} // namespace layers -} // namespace mozilla - -#endif diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp deleted file mode 100644 index dd522e6503..0000000000 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "MacIOSurfaceTextureClientOGL.h" -#include "mozilla/gfx/MacIOSurface.h" -#include "MacIOSurfaceHelpers.h" -#include "gfxPlatform.h" - -namespace mozilla { -namespace layers { - -using namespace gfx; - -MacIOSurfaceTextureData::MacIOSurfaceTextureData(MacIOSurface* aSurface, - BackendType aBackend) - : mSurface(aSurface) - , mBackend(aBackend) -{ - MOZ_ASSERT(mSurface); -} - -MacIOSurfaceTextureData::~MacIOSurfaceTextureData() -{} - -// static -MacIOSurfaceTextureData* -MacIOSurfaceTextureData::Create(MacIOSurface* aSurface, BackendType aBackend) -{ - MOZ_ASSERT(aSurface); - if (!aSurface) { - return nullptr; - } - return new MacIOSurfaceTextureData(aSurface, aBackend); -} - -MacIOSurfaceTextureData* -MacIOSurfaceTextureData::Create(const IntSize& aSize, - SurfaceFormat aFormat, - BackendType aBackend) -{ - if (aFormat != SurfaceFormat::B8G8R8A8 && - aFormat != SurfaceFormat::B8G8R8X8) { - return nullptr; - } - - RefPtr<MacIOSurface> surf = MacIOSurface::CreateIOSurface(aSize.width, aSize.height, - 1.0, - aFormat == SurfaceFormat::B8G8R8A8); - if (!surf) { - return nullptr; - } - - return Create(surf, aBackend); -} - -bool -MacIOSurfaceTextureData::Serialize(SurfaceDescriptor& aOutDescriptor) -{ - aOutDescriptor = SurfaceDescriptorMacIOSurface(mSurface->GetIOSurfaceID(), - mSurface->GetContentsScaleFactor(), - !mSurface->HasAlpha()); - return true; -} - -void -MacIOSurfaceTextureData::FillInfo(TextureData::Info& aInfo) const -{ - aInfo.size = gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight()); - aInfo.format = mSurface->HasAlpha() ? SurfaceFormat::B8G8R8A8 : SurfaceFormat::B8G8R8X8; - aInfo.hasIntermediateBuffer = false; - aInfo.hasSynchronization = false; - aInfo.supportsMoz2D = true; - aInfo.canExposeMappedData = false; -} - -bool -MacIOSurfaceTextureData::Lock(OpenMode) -{ - mSurface->Lock(false); - return true; -} - -void -MacIOSurfaceTextureData::Unlock() -{ - mSurface->Unlock(false); -} - -already_AddRefed<DataSourceSurface> -MacIOSurfaceTextureData::GetAsSurface() -{ - RefPtr<SourceSurface> surf = CreateSourceSurfaceFromMacIOSurface(mSurface); - return surf->GetDataSurface(); -} - -already_AddRefed<DrawTarget> -MacIOSurfaceTextureData::BorrowDrawTarget() -{ - MOZ_ASSERT(mBackend != BackendType::NONE); - if (mBackend == BackendType::NONE) { - // shouldn't happen, but degrade gracefully - return nullptr; - } - return Factory::CreateDrawTargetForData( - mBackend, - (unsigned char*)mSurface->GetBaseAddress(), - IntSize(mSurface->GetWidth(), mSurface->GetHeight()), - mSurface->GetBytesPerRow(), - mSurface->HasAlpha() ? SurfaceFormat::B8G8R8A8 : SurfaceFormat::B8G8R8X8, - true); -} - -void -MacIOSurfaceTextureData::Deallocate(LayersIPCChannel*) -{ - mSurface = nullptr; -} - -void -MacIOSurfaceTextureData::Forget(LayersIPCChannel*) -{ - mSurface = nullptr; -} - -bool -MacIOSurfaceTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface) -{ - RefPtr<DrawTarget> dt = BorrowDrawTarget(); - if (!dt) { - return false; - } - - dt->CopySurface(aSurface, IntRect(IntPoint(), aSurface->GetSize()), IntPoint()); - return true; -} - -} // namespace layers -} // namespace mozilla diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h deleted file mode 100644 index 21e4459537..0000000000 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H -#define MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H - -#include "mozilla/layers/TextureClientOGL.h" - -class MacIOSurface; - -namespace mozilla { -namespace layers { - -class MacIOSurfaceTextureData : public TextureData -{ -public: - static MacIOSurfaceTextureData* Create(MacIOSurface* aSurface, - gfx::BackendType aBackend); - - static MacIOSurfaceTextureData* - Create(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat, - gfx::BackendType aBackend); - - ~MacIOSurfaceTextureData(); - - virtual void FillInfo(TextureData::Info& aInfo) const override; - - virtual bool Lock(OpenMode) override; - - virtual void Unlock() override; - - virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override; - - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - - virtual void Deallocate(LayersIPCChannel*) override; - - virtual void Forget(LayersIPCChannel*) override; - - virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; - - // For debugging purposes only. - already_AddRefed<gfx::DataSourceSurface> GetAsSurface(); - -protected: - MacIOSurfaceTextureData(MacIOSurface* aSurface, - gfx::BackendType aBackend); - - RefPtr<MacIOSurface> mSurface; - gfx::BackendType mBackend; -}; - -} // namespace layers -} // namespace mozilla - -#endif // MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp deleted file mode 100644 index 9736618f7e..0000000000 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "MacIOSurfaceTextureHostOGL.h" -#include "mozilla/gfx/MacIOSurface.h" -#include "GLContextCGL.h" - -namespace mozilla { -namespace layers { - -MacIOSurfaceTextureHostOGL::MacIOSurfaceTextureHostOGL(TextureFlags aFlags, - const SurfaceDescriptorMacIOSurface& aDescriptor) - : TextureHost(aFlags) -{ - MOZ_COUNT_CTOR(MacIOSurfaceTextureHostOGL); - mSurface = MacIOSurface::LookupSurface(aDescriptor.surfaceId(), - aDescriptor.scaleFactor(), - !aDescriptor.isOpaque()); -} - -MacIOSurfaceTextureHostOGL::~MacIOSurfaceTextureHostOGL() -{ - MOZ_COUNT_DTOR(MacIOSurfaceTextureHostOGL); -} - -GLTextureSource* -MacIOSurfaceTextureHostOGL::CreateTextureSourceForPlane(size_t aPlane) -{ - MOZ_ASSERT(mSurface); - - GLuint textureHandle; - gl::GLContext* gl = mCompositor->gl(); - gl->fGenTextures(1, &textureHandle); - gl->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, textureHandle); - gl->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE); - gl->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE); - - mSurface->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(gl)->GetCGLContext(), aPlane); - - return new GLTextureSource(mCompositor, textureHandle, LOCAL_GL_TEXTURE_RECTANGLE_ARB, - gfx::IntSize(mSurface->GetDevicePixelWidth(aPlane), - mSurface->GetDevicePixelHeight(aPlane)), - // XXX: This isn't really correct (but isn't used), we should be using the - // format of the individual plane, not of the whole buffer. - mSurface->GetFormat()); -} - -bool -MacIOSurfaceTextureHostOGL::Lock() -{ - if (!gl() || !gl()->MakeCurrent() || !mSurface) { - return false; - } - - if (!mTextureSource) { - mTextureSource = CreateTextureSourceForPlane(0); - - RefPtr<TextureSource> prev = mTextureSource; - for (size_t i = 1; i < mSurface->GetPlaneCount(); i++) { - RefPtr<TextureSource> next = CreateTextureSourceForPlane(i); - prev->SetNextSibling(next); - prev = next; - } - } - return true; -} - -void -MacIOSurfaceTextureHostOGL::SetCompositor(Compositor* aCompositor) -{ - CompositorOGL* glCompositor = AssertGLCompositor(aCompositor); - if (!glCompositor) { - mTextureSource = nullptr; - mCompositor = nullptr; - return; - } - - if (mCompositor != glCompositor) { - // Cannot share GL texture identifiers across compositors. - mTextureSource = nullptr; - } - mCompositor = glCompositor; -} - -gfx::SurfaceFormat -MacIOSurfaceTextureHostOGL::GetFormat() const { - if (!mSurface) { - return gfx::SurfaceFormat::UNKNOWN; - } - return mSurface->GetFormat(); -} - -gfx::SurfaceFormat -MacIOSurfaceTextureHostOGL::GetReadFormat() const { - if (!mSurface) { - return gfx::SurfaceFormat::UNKNOWN; - } - return mSurface->GetReadFormat(); -} - -gfx::IntSize -MacIOSurfaceTextureHostOGL::GetSize() const { - if (!mSurface) { - return gfx::IntSize(); - } - return gfx::IntSize(mSurface->GetDevicePixelWidth(), - mSurface->GetDevicePixelHeight()); -} - -gl::GLContext* -MacIOSurfaceTextureHostOGL::gl() const -{ - return mCompositor ? mCompositor->gl() : 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::SetCompositor(Compositor* aCompositor) -{ - mCompositor = AssertGLCompositor(aCompositor); - if (mCompositor && mNextSibling) { - mNextSibling->SetCompositor(aCompositor); - } -} - -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 deleted file mode 100644 index 55e2f5019a..0000000000 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H -#define MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H - -#include "mozilla/layers/CompositorOGL.h" -#include "mozilla/layers/TextureHostOGL.h" - -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 SetCompositor(Compositor* aCompositor) override; - - gl::GLContext* gl() const; - -protected: - RefPtr<CompositorOGL> mCompositor; - RefPtr<MacIOSurface> mSurface; -}; - -/** - * A TextureHost for shared MacIOSurface - * - * Most of the logic actually happens in MacIOSurfaceTextureSourceOGL. - */ -class MacIOSurfaceTextureHostOGL : public TextureHost -{ -public: - MacIOSurfaceTextureHostOGL(TextureFlags aFlags, - const SurfaceDescriptorMacIOSurface& aDescriptor); - virtual ~MacIOSurfaceTextureHostOGL(); - - // MacIOSurfaceTextureSourceOGL doesn't own any GL texture - virtual void DeallocateDeviceData() override {} - - virtual void SetCompositor(Compositor* aCompositor) override; - - virtual Compositor* GetCompositor() override { return mCompositor; } - - virtual bool Lock() override; - - virtual gfx::SurfaceFormat GetFormat() const override; - virtual gfx::SurfaceFormat GetReadFormat() const override; - - virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override - { - aTexture = mTextureSource; - return !!aTexture; - } - - virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override - { - return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) - } - - gl::GLContext* gl() const; - - virtual gfx::IntSize GetSize() const override; - -#ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "MacIOSurfaceTextureHostOGL"; } -#endif - -protected: - GLTextureSource* CreateTextureSourceForPlane(size_t aPlane); - - RefPtr<CompositorOGL> mCompositor; - RefPtr<GLTextureSource> mTextureSource; - RefPtr<MacIOSurface> mSurface; -}; - -} // namespace layers -} // namespace mozilla - -#endif // MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py index de0a5c52e4..86fc554a16 100755 --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -69,7 +69,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): if CONFIG['MOZ_WIDGET_TOOLKIT'] in { 'android', - 'cocoa', 'gtk2', 'gtk3', 'uikit', @@ -459,7 +458,7 @@ def write_mozbuild(sources): f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'):\n") write_sources(f, sources['android'], 4) - f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'cocoa', 'uikit'}:\n") + f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'uikit'}:\n") write_sources(f, sources['mac'], 4) f.write("if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:\n") diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build index c218f64776..d2ab9566fe 100644 --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -528,7 +528,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): 'skia/src/ports/SkFontHost_cairo.cpp', 'skia/src/ports/SkFontHost_FreeType_common.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'cocoa', 'uikit'}: +if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'uikit'}: SOURCES += [ 'skia/src/ports/SkDebug_stdio.cpp', 'skia/src/ports/SkOSFile_posix.cpp', @@ -679,7 +679,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): if CONFIG['MOZ_WIDGET_TOOLKIT'] in { 'android', - 'cocoa', 'gtk2', 'gtk3', 'uikit', |