mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 887791 - Add a TextureClient implementation for MacIOSurface. r=nical
This commit is contained in:
parent
770c0c7a31
commit
d5d855efb3
@ -51,6 +51,12 @@ struct SurfaceDescriptorD3D10 {
|
||||
bool hasAlpha;
|
||||
};
|
||||
|
||||
struct SurfaceDescriptorMacIOSurface {
|
||||
uint32_t surface;
|
||||
double scaleFactor;
|
||||
bool hasAlpha;
|
||||
};
|
||||
|
||||
struct SharedTextureDescriptor {
|
||||
SharedTextureShareType shareType;
|
||||
SharedTextureHandle handle;
|
||||
@ -176,6 +182,7 @@ union SurfaceDescriptor {
|
||||
SurfaceDescriptorX11;
|
||||
SharedTextureDescriptor;
|
||||
SurfaceStreamDescriptor;
|
||||
SurfaceDescriptorMacIOSurface;
|
||||
NewSurfaceDescriptorGralloc;
|
||||
YCbCrImage; // XXX - deprecated
|
||||
SurfaceDescriptorGralloc; // XXX - deprecated
|
||||
|
@ -66,7 +66,20 @@ SharedTextureClientOGL::IsAllocated() const
|
||||
return mHandle != 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
bool
|
||||
MacIOSurfaceTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
aOutDescriptor = SurfaceDescriptorMacIOSurface(mSurface->GetIOSurfaceID(),
|
||||
mSurface->GetContentsScaleFactor(),
|
||||
mSurface->HasAlpha());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
DeprecatedTextureClientSharedOGL::DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo)
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
||||
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient, etc
|
||||
#ifdef XP_MACOSX
|
||||
#include "mozilla/gfx/MacIOSurface.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -57,6 +60,44 @@ protected:
|
||||
bool mInverted;
|
||||
};
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
class MacIOSurfaceTextureClientOGL : public TextureClient
|
||||
{
|
||||
public:
|
||||
MacIOSurfaceTextureClientOGL(TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
{}
|
||||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
void InitWith(MacIOSurface* aSurface)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
MOZ_ASSERT(!IsAllocated());
|
||||
mSurface = aSurface;
|
||||
}
|
||||
|
||||
virtual gfx::IntSize GetSize() const
|
||||
{
|
||||
return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
|
||||
}
|
||||
|
||||
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE
|
||||
{
|
||||
// MacIOSurface has proper cross-process refcounting so we can just drop
|
||||
// our reference now, and the data will stay alive (at least) until the host
|
||||
// has also been torn down.
|
||||
mSurface = nullptr;
|
||||
MarkInvalid();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
RefPtr<MacIOSurface> mSurface;
|
||||
};
|
||||
#endif
|
||||
|
||||
class DeprecatedTextureClientSharedOGL : public DeprecatedTextureClient
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user