mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1036785: Use DIBs for drawing when not using opaque surfaces. r=nical
This commit is contained in:
parent
1a3c189ac3
commit
b9a7152efc
168
gfx/layers/TextureDIB.cpp
Normal file
168
gfx/layers/TextureDIB.cpp
Normal file
@ -0,0 +1,168 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "TextureDIB.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
namespace layers {
|
||||
|
||||
DIBTextureClient::DIBTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mFormat(aFormat)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DIBTextureClient);
|
||||
}
|
||||
|
||||
DIBTextureClient::~DIBTextureClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DIBTextureClient);
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::Lock(OpenMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureClient::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!");
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->Flush();
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(mSurface);
|
||||
// The host will release this ref when it receives the surface descriptor.
|
||||
// We AddRef in case we die before the host receives the pointer.
|
||||
aOutDescriptor = SurfaceDescriptorDIB(reinterpret_cast<uintptr_t>(mSurface.get()));
|
||||
mSurface->AddRef();
|
||||
return true;
|
||||
}
|
||||
|
||||
gfx::DrawTarget*
|
||||
DIBTextureClient::BorrowDrawTarget()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked && IsAllocated());
|
||||
|
||||
if (!mDrawTarget) {
|
||||
mDrawTarget =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mSurface, mSize);
|
||||
}
|
||||
|
||||
return mDrawTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!IsAllocated());
|
||||
mSize = aSize;
|
||||
|
||||
mSurface = new gfxWindowsSurface(gfxIntSize(aSize.width, aSize.height),
|
||||
SurfaceFormatToImageFormat(mFormat));
|
||||
if (!mSurface || mSurface->CairoStatus())
|
||||
{
|
||||
NS_WARNING("Could not create surface");
|
||||
mSurface = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DIBTextureHost::DIBTextureHost(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor)
|
||||
: TextureHost(aFlags)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
// We added an extra ref for transport, so we shouldn't AddRef now.
|
||||
mSurface =
|
||||
dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aDescriptor.surface()));
|
||||
MOZ_ASSERT(mSurface);
|
||||
|
||||
mSize = ToIntSize(mSurface->GetSize());
|
||||
mFormat = ImageFormatToSurfaceFormat(
|
||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(mSurface->GetContentType()));
|
||||
}
|
||||
|
||||
NewTextureSource*
|
||||
DIBTextureHost::GetTextureSources()
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
Updated();
|
||||
}
|
||||
|
||||
return mTextureSource;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::Updated(const nsIntRegion* aRegion)
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
mTextureSource = mCompositor->CreateDataTextureSource(mFlags);
|
||||
}
|
||||
|
||||
nsRefPtr<gfxImageSurface> imgSurf = mSurface->GetAsImageSurface();
|
||||
|
||||
RefPtr<DataSourceSurface> surf = Factory::CreateWrappingDataSourceSurface(imgSurf->Data(), imgSurf->Stride(), mSize, mFormat);
|
||||
|
||||
if (!mTextureSource->Update(surf, const_cast<nsIntRegion*>(aRegion))) {
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureHost::Lock()
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mCompositor = aCompositor;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::DeallocateDeviceData()
|
||||
{
|
||||
if (mTextureSource) {
|
||||
mTextureSource->DeallocateDeviceData();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
102
gfx/layers/TextureDIB.h
Normal file
102
gfx/layers/TextureDIB.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- 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 MOZILLA_GFX_TEXTUREDIB_H
|
||||
#define MOZILLA_GFX_TEXTUREDIB_H
|
||||
|
||||
#include "mozilla/layers/Compositor.h"
|
||||
#include "mozilla/layers/TextureClient.h"
|
||||
#include "mozilla/layers/TextureHost.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
/**
|
||||
* Can only be drawn into through Cairo.
|
||||
* Prefer CairoTextureClient when possible.
|
||||
* The coresponding TextureHost depends on the compositor
|
||||
*/
|
||||
class DIBTextureClient : public TextureClient
|
||||
{
|
||||
public:
|
||||
DIBTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
|
||||
virtual ~DIBTextureClient();
|
||||
|
||||
// TextureClient
|
||||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
|
||||
|
||||
virtual bool Lock(OpenMode aOpenMode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE{ return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual gfx::DrawTarget* BorrowDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||
gfx::IntSize mSize;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
class DIBTextureHost : public TextureHost
|
||||
{
|
||||
public:
|
||||
DIBTextureHost(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor);
|
||||
|
||||
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE;
|
||||
|
||||
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual bool Lock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Updated(const nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr; // TODO: cf bug 872568
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<DataTextureSource> mTextureSource;
|
||||
RefPtr<Compositor> mCompositor;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
gfx::IntSize mSize;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MOZILLA_GFX_TEXTUREDIB_H */
|
@ -25,6 +25,7 @@
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/layers/TextureD3D9.h"
|
||||
#include "mozilla/layers/TextureD3D11.h"
|
||||
#include "mozilla/layers/TextureDIB.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#endif
|
||||
@ -263,12 +264,16 @@ CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
|
||||
aSizeHint.width <= maxTextureSize &&
|
||||
aSizeHint.height <= maxTextureSize &&
|
||||
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
|
||||
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
|
||||
} else {
|
||||
if (gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
result = new CairoTextureClientD3D9(aFormat, aTextureFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if (!result && aFormat == SurfaceFormat::B8G8R8X8 &&
|
||||
aAllocator->IsSameProcess()) {
|
||||
result = new DIBTextureClient(aFormat, aTextureFlags);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
|
@ -50,6 +50,7 @@
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "SharedSurfaceANGLE.h"
|
||||
#include "mozilla/layers/TextureDIB.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@ -201,6 +202,7 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
switch (aDesc.type()) {
|
||||
case SurfaceDescriptor::TSurfaceDescriptorShmem:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
||||
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
||||
|
||||
case SurfaceDescriptor::TSharedTextureDescriptor:
|
||||
@ -227,7 +229,6 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
|
||||
#ifdef XP_WIN
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D9:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
||||
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
|
||||
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
|
||||
@ -264,6 +265,12 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
|
||||
aFlags);
|
||||
break;
|
||||
}
|
||||
#ifdef XP_WIN
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB: {
|
||||
result = new DIBTextureHost(aFlags, aDesc);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
NS_WARNING("No backend independent TextureHost for this descriptor type");
|
||||
}
|
||||
|
@ -62,10 +62,6 @@ CreateTextureHostD3D9(const SurfaceDescriptor& aDesc,
|
||||
result = new TextureHostD3D9(aFlags, aDesc);
|
||||
break;
|
||||
}
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB: {
|
||||
result = new DIBTextureHostD3D9(aFlags, aDesc);
|
||||
break;
|
||||
}
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D10: {
|
||||
result = new DXGITextureHostD3D9(aFlags, aDesc);
|
||||
break;
|
||||
@ -705,88 +701,6 @@ CairoTextureClientD3D9::AllocateForSurface(gfx::IntSize aSize, TextureAllocation
|
||||
return true;
|
||||
}
|
||||
|
||||
DIBTextureClientD3D9::DIBTextureClientD3D9(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mFormat(aFormat)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DIBTextureClientD3D9);
|
||||
}
|
||||
|
||||
DIBTextureClientD3D9::~DIBTextureClientD3D9()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DIBTextureClientD3D9);
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClientD3D9::Lock(OpenMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureClientD3D9::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!");
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->Flush();
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClientD3D9::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(mSurface);
|
||||
// The host will release this ref when it receives the surface descriptor.
|
||||
// We AddRef in case we die before the host receives the pointer.
|
||||
aOutDescriptor = SurfaceDescriptorDIB(reinterpret_cast<uintptr_t>(mSurface.get()));
|
||||
mSurface->AddRef();
|
||||
return true;
|
||||
}
|
||||
|
||||
gfx::DrawTarget*
|
||||
DIBTextureClientD3D9::BorrowDrawTarget()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked && IsAllocated());
|
||||
|
||||
if (!mDrawTarget) {
|
||||
mDrawTarget =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mSurface, mSize);
|
||||
}
|
||||
|
||||
return mDrawTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClientD3D9::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!IsAllocated());
|
||||
mSize = aSize;
|
||||
|
||||
mSurface = new gfxWindowsSurface(gfxIntSize(aSize.width, aSize.height),
|
||||
SurfaceFormatToImageFormat(mFormat));
|
||||
if (!mSurface || mSurface->CairoStatus())
|
||||
{
|
||||
NS_WARNING("Could not create surface");
|
||||
mSurface = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SharedTextureClientD3D9::SharedTextureClientD3D9(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mFormat(aFormat)
|
||||
@ -977,70 +891,6 @@ TextureHostD3D9::DeallocateDeviceData()
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
|
||||
DIBTextureHostD3D9::DIBTextureHostD3D9(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor)
|
||||
: TextureHost(aFlags)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
// We added an extra ref for transport, so we shouldn't AddRef now.
|
||||
mSurface =
|
||||
dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aDescriptor.surface()));
|
||||
MOZ_ASSERT(mSurface);
|
||||
|
||||
mSize = ToIntSize(mSurface->GetSize());
|
||||
mFormat = ImageFormatToSurfaceFormat(
|
||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(mSurface->GetContentType()));
|
||||
}
|
||||
|
||||
NewTextureSource*
|
||||
DIBTextureHostD3D9::GetTextureSources()
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
Updated();
|
||||
}
|
||||
|
||||
return mTextureSource;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHostD3D9::Updated(const nsIntRegion*)
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
mTextureSource = new DataTextureSourceD3D9(mFormat, mCompositor, mFlags);
|
||||
}
|
||||
|
||||
if (!mTextureSource->Update(mSurface)) {
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureHostD3D9::Lock()
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHostD3D9::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHostD3D9::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mCompositor = static_cast<CompositorD3D9*>(aCompositor);
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHostD3D9::DeallocateDeviceData()
|
||||
{
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
|
||||
DXGITextureHostD3D9::DXGITextureHostD3D9(TextureFlags aFlags,
|
||||
const SurfaceDescriptorD3D10& aDescriptor)
|
||||
: TextureHost(aFlags)
|
||||
|
@ -229,51 +229,6 @@ private:
|
||||
bool mLockRect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Can only be drawn into through Cairo.
|
||||
* Prefer CairoTextureClientD3D9 when possible.
|
||||
* The coresponding TextureHost is DIBTextureHostD3D9.
|
||||
*/
|
||||
class DIBTextureClientD3D9 : public TextureClient
|
||||
{
|
||||
public:
|
||||
DIBTextureClientD3D9(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
|
||||
virtual ~DIBTextureClientD3D9();
|
||||
|
||||
// TextureClient
|
||||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
|
||||
|
||||
virtual bool Lock(OpenMode aOpenMode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const { return mSize; }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
|
||||
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual gfx::DrawTarget* BorrowDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||
gfx::IntSize mSize;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
/**
|
||||
* Wraps a D3D9 texture, shared with the compositor though DXGI.
|
||||
* At the moment it is only used with D3D11 compositing, and the corresponding
|
||||
@ -362,42 +317,6 @@ protected:
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
class DIBTextureHostD3D9 : public TextureHost
|
||||
{
|
||||
public:
|
||||
DIBTextureHostD3D9(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor);
|
||||
|
||||
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE;
|
||||
|
||||
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual bool Lock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Updated(const nsIntRegion* aRegion = nullptr);
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr; // TODO: cf bug 872568
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<DataTextureSourceD3D9> mTextureSource;
|
||||
RefPtr<CompositorD3D9> mCompositor;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
gfx::IntSize mSize;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
class DXGITextureHostD3D9 : public TextureHost
|
||||
{
|
||||
public:
|
||||
|
@ -44,6 +44,10 @@ EXPORTS += [
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
UNIFIED_SOURCES += [
|
||||
'D3D9SurfaceImage.cpp',
|
||||
'TextureDIB.cpp',
|
||||
]
|
||||
EXPORTS.mozilla.layers += [
|
||||
'TextureDIB.h',
|
||||
]
|
||||
if CONFIG['MOZ_ENABLE_D3D9_LAYER']:
|
||||
EXPORTS += [
|
||||
|
Loading…
Reference in New Issue
Block a user