Bug 808469 - Use gfxQuartzSurface for OMTC drawing on mac. r=cjones

This commit is contained in:
Matt Woodrow 2012-11-07 19:56:56 +13:00
parent 61fe215c09
commit 07869c9c29
5 changed files with 128 additions and 0 deletions

View File

@ -172,6 +172,10 @@ EXPORTS_mozilla/layers += ShadowLayerUtilsD3D10.h
DEFINES += -DMOZ_ENABLE_D3D10_LAYER
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CPPSRCS += ShadowLayerUtilsMac.cpp
endif
# NB: Gralloc is available on other platforms that use the android GL
# libraries, but only Gonk is able to use it reliably because Gecko
# has full system permissions there.

View File

@ -16,6 +16,10 @@
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
#endif
#if defined(XP_MACOSX)
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
#endif
#if defined(MOZ_X11)
# include "mozilla/layers/ShadowLayerUtilsX11.h"
#else

View File

@ -0,0 +1,94 @@
/* -*- 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/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "gfxPlatform.h"
#include "gfxSharedQuartzSurface.h"
using namespace mozilla::gl;
namespace mozilla {
namespace layers {
bool
ShadowLayerForwarder::PlatformAllocBuffer(const gfxIntSize& aSize,
gfxASurface::gfxContentType aContent,
uint32_t aCaps,
SurfaceDescriptor* aBuffer)
{
return false;
}
/*static*/ already_AddRefed<gfxASurface>
ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
const SurfaceDescriptor& aSurface)
{
if (SurfaceDescriptor::TShmem != aSurface.type()) {
return nullptr;
}
return gfxSharedQuartzSurface::Open(aSurface.get_Shmem());
}
/*static*/ bool
ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor& aDescriptor)
{
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
gfxContentType* aContent,
gfxASurface** aSurface)
{
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
gfxIntSize* aSize,
gfxASurface** aSurface)
{
return false;
}
bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
{
return false;
}
/*static*/ void
ShadowLayerForwarder::PlatformSyncBeforeUpdate()
{
}
/*static*/ void
ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
{
}
bool
ShadowLayerManager::PlatformDestroySharedSurface(SurfaceDescriptor*)
{
return false;
}
/*static*/ already_AddRefed<TextureImage>
ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext*,
const SurfaceDescriptor&,
GLenum)
{
return nullptr;
}
} // namespace layers
} // namespace mozilla

View File

@ -51,6 +51,7 @@ EXPORTS = \
nsSurfaceTexture.h \
gfxBaseSharedMemorySurface.h \
gfxSharedImageSurface.h \
gfxSharedQuartzSurface.h \
gfxReusableSurfaceWrapper.h \
gfxSVGGlyphs.h \
$(NULL)

View File

@ -0,0 +1,25 @@
// vim:set ts=4 sts=4 sw=4 et cin:
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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 GFX_SHARED_QUARTZSURFACE_H
#define GFX_SHARED_QUARTZSURFACE_H
#include "gfxBaseSharedMemorySurface.h"
#include "gfxQuartzSurface.h"
class gfxSharedQuartzSurface : public gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface>
{
typedef gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface> Super;
friend class gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface>;
private:
gfxSharedQuartzSurface(const gfxIntSize& aSize, long aStride,
gfxASurface::gfxImageFormat aFormat,
const mozilla::ipc::Shmem& aShmem)
: Super(aSize, aStride, aFormat, aShmem)
{}
};
#endif /* GFX_SHARED_QUARTZSURFACE_H */