mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990871 - Move TextureClientDrawTarget into TextureClient. r=mattwoodrow
This commit is contained in:
parent
b36a784062
commit
266db399dd
@ -628,15 +628,15 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
|
||||
TEXTURE_FLAGS_DEFAULT,
|
||||
gfx::BackendType::NONE,
|
||||
surface->GetSize());
|
||||
MOZ_ASSERT(textureClient->AsTextureClientDrawTarget());
|
||||
if (!textureClient->AsTextureClientDrawTarget()->AllocateForSurface(surface->GetSize()) ||
|
||||
MOZ_ASSERT(textureClient->CanExposeDrawTarget());
|
||||
if (!textureClient->AllocateForSurface(surface->GetSize()) ||
|
||||
!textureClient->Lock(OPEN_WRITE_ONLY)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
{
|
||||
// We must not keep a reference to the DrawTarget after it has been unlocked.
|
||||
RefPtr<DrawTarget> dt = textureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> dt = textureClient->GetAsDrawTarget();
|
||||
dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ RotatedContentBuffer::BufferContentType()
|
||||
SurfaceFormat format;
|
||||
|
||||
if (mBufferProvider) {
|
||||
format = mBufferProvider->AsTextureClientDrawTarget()->GetFormat();
|
||||
format = mBufferProvider->GetFormat();
|
||||
} else if (mDTBuffer) {
|
||||
format = mDTBuffer->GetFormat();
|
||||
}
|
||||
@ -331,7 +331,7 @@ RotatedContentBuffer::EnsureBuffer()
|
||||
NS_ASSERTION(!mLoanedDrawTarget, "Loaned draw target must be returned");
|
||||
if (!mDTBuffer) {
|
||||
if (mBufferProvider) {
|
||||
mDTBuffer = mBufferProvider->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
mDTBuffer = mBufferProvider->GetAsDrawTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ RotatedContentBuffer::EnsureBufferOnWhite()
|
||||
if (!mDTBufferOnWhite) {
|
||||
if (mBufferProviderOnWhite) {
|
||||
mDTBufferOnWhite =
|
||||
mBufferProviderOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
mBufferProviderOnWhite->GetAsDrawTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,7 @@ namespace layers {
|
||||
*/
|
||||
class TextureClientX11
|
||||
: public TextureClient,
|
||||
public TextureClientSurface,
|
||||
public TextureClientDrawTarget
|
||||
public TextureClientSurface
|
||||
{
|
||||
public:
|
||||
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
|
||||
@ -28,7 +27,6 @@ class TextureClientX11
|
||||
// TextureClient
|
||||
|
||||
TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
|
||||
TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
|
||||
|
||||
bool IsAllocated() const MOZ_OVERRIDE;
|
||||
bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
@ -47,8 +45,6 @@ class TextureClientX11
|
||||
already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientDrawTarget
|
||||
|
||||
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
gfx::SurfaceFormat GetFormat() const {
|
||||
return mFormat;
|
||||
|
@ -88,7 +88,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
{
|
||||
// Restrict drawTarget to a scope so that terminates before Unlock.
|
||||
RefPtr<DrawTarget> target =
|
||||
mBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
mBuffer->GetAsDrawTarget();
|
||||
if (target) {
|
||||
aLayer->UpdateTarget(target);
|
||||
updated = true;
|
||||
|
@ -85,8 +85,6 @@ public:
|
||||
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
|
||||
gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
|
||||
|
||||
// If we return a non-null TextureClient, then AsTextureClientDrawTarget will
|
||||
// always be non-null.
|
||||
TemporaryRef<TextureClient>
|
||||
CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
|
||||
TextureFlags aTextureFlags,
|
||||
|
@ -195,7 +195,7 @@ ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>&
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
||||
if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
||||
aClient = CreateTextureClientForDrawing(mSurfaceFormat,
|
||||
mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags,
|
||||
gfx::BackendType::NONE,
|
||||
@ -203,7 +203,7 @@ ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>&
|
||||
if (!aClient) {
|
||||
return false;
|
||||
}
|
||||
if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
||||
if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
||||
NS_WARNING("Could not allocate texture client");
|
||||
aClient = nullptr;
|
||||
return false;
|
||||
@ -271,12 +271,12 @@ ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
|
||||
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
||||
MOZ_ASSERT(locked, "Could not lock the TextureClient");
|
||||
|
||||
*aBlackDT = mTextureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
*aBlackDT = mTextureClient->GetAsDrawTarget();
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
||||
MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
|
||||
|
||||
*aWhiteDT = mTextureClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
*aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,10 +477,9 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
|
||||
// Restrict the DrawTargets and frontBuffer to a scope to make
|
||||
// sure there is no more external references to the DrawTargets
|
||||
// when we Unlock the TextureClients.
|
||||
RefPtr<DrawTarget> dt =
|
||||
mFrontClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> dt = mFrontClient->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> dtOnWhite = mFrontClientOnWhite
|
||||
? mFrontClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget()
|
||||
? mFrontClientOnWhite->GetAsDrawTarget()
|
||||
: nullptr;
|
||||
RotatedBuffer frontBuffer(dt,
|
||||
dtOnWhite,
|
||||
|
@ -233,8 +233,8 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
|
||||
= gfxPlatform::GetPlatform()->OptimalFormatForContent(gfx::ContentForFormat(surface->GetFormat()));
|
||||
mFrontBuffer = CreateTextureClientForDrawing(gfx::ImageFormatToSurfaceFormat(format),
|
||||
mTextureFlags, gfx::BackendType::NONE, size);
|
||||
MOZ_ASSERT(mFrontBuffer->AsTextureClientDrawTarget());
|
||||
if (!mFrontBuffer->AsTextureClientDrawTarget()->AllocateForSurface(size)) {
|
||||
MOZ_ASSERT(mFrontBuffer->CanExposeDrawTarget());
|
||||
if (!mFrontBuffer->AllocateForSurface(size)) {
|
||||
mFrontBuffer = nullptr;
|
||||
return false;
|
||||
}
|
||||
@ -248,7 +248,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
|
||||
|
||||
{
|
||||
// We must not keep a reference to the DrawTarget after it has been unlocked.
|
||||
RefPtr<DrawTarget> dt = mFrontBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> dt = mFrontBuffer->GetAsDrawTarget();
|
||||
MOZ_ASSERT(surface.get());
|
||||
dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ SimpleTextureClientPool::GetTextureClient(bool aAutoRecycle)
|
||||
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
|
||||
mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE, gfx::BackendType::NONE, mSize);
|
||||
}
|
||||
if (!textureClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
|
||||
if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
|
||||
NS_WARNING("TextureClient::AllocateForSurface failed!");
|
||||
}
|
||||
RECYCLE_LOG("%s Must allocate (0 left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), textureClient.get());
|
||||
|
@ -147,7 +147,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
|
||||
|
||||
// this might get set above if we couldn't extract out a buffer
|
||||
if (!doBufferedDrawing) {
|
||||
drawTarget = textureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
drawTarget = textureClient->GetAsDrawTarget();
|
||||
|
||||
fullPaint = true;
|
||||
drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileSize().width, GetScaledTileSize().height);
|
||||
|
@ -356,8 +356,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
|
||||
result = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!result || result->AsTextureClientDrawTarget(),
|
||||
"Not a TextureClientDrawTarget?");
|
||||
MOZ_ASSERT(!result || result->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -491,12 +490,12 @@ bool TextureClient::CopyToTextureClient(TextureClient* aTarget,
|
||||
MOZ_ASSERT(IsLocked());
|
||||
MOZ_ASSERT(aTarget->IsLocked());
|
||||
|
||||
if (!aTarget->AsTextureClientDrawTarget() || !AsTextureClientDrawTarget()) {
|
||||
if (!aTarget->CanExposeDrawTarget() || !CanExposeDrawTarget()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> destinationTarget = aTarget->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> sourceTarget = AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> destinationTarget = aTarget->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> sourceTarget = GetAsDrawTarget();
|
||||
RefPtr<gfx::SourceSurface> source = sourceTarget->Snapshot();
|
||||
destinationTarget->CopySurface(source,
|
||||
aRect ? *aRect : gfx::IntRect(gfx::IntPoint(0, 0), GetSize()),
|
||||
@ -796,7 +795,7 @@ BufferTextureClient::Unlock()
|
||||
return;
|
||||
}
|
||||
|
||||
// see the comment on TextureClientDrawTarget::GetAsDrawTarget.
|
||||
// see the comment on TextureClient::GetAsDrawTarget.
|
||||
// This DrawTarget is internal to the TextureClient and is only exposed to the
|
||||
// outside world between Lock() and Unlock(). This assertion checks that no outside
|
||||
// reference remains by the time Unlock() is called.
|
||||
|
@ -79,50 +79,6 @@ public:
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for TextureClients that can be updated using a DrawTarget.
|
||||
*/
|
||||
class TextureClientDrawTarget
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Returns a DrawTarget to draw into the TextureClient.
|
||||
*
|
||||
* This must never be called on a TextureClient that is not sucessfully locked.
|
||||
* When called several times within one Lock/Unlock pair, this method should
|
||||
* return the same DrawTarget.
|
||||
* The DrawTarget is automatically flushed by the TextureClient when the latter
|
||||
* is unlocked, and the DrawTarget that will be returned within the next
|
||||
* lock/unlock pair may or may not be the same object.
|
||||
* Do not keep references to the DrawTarget outside of the lock/unlock pair.
|
||||
*
|
||||
* This is typically used as follows:
|
||||
*
|
||||
* if (!texture->Lock(OPEN_READ_WRITE)) {
|
||||
* return false;
|
||||
* }
|
||||
* {
|
||||
* // Restrict this code's scope to ensure all references to dt are gone
|
||||
* // when Unlock is called.
|
||||
* RefPtr<DrawTarget> dt = texture->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
* // use the draw target ...
|
||||
* }
|
||||
* texture->Unlock();
|
||||
*
|
||||
*/
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() = 0;
|
||||
virtual gfx::SurfaceFormat GetFormat() const = 0;
|
||||
/**
|
||||
* Allocates for a given surface size, taking into account the pixel format
|
||||
* which is part of the state of the TextureClient.
|
||||
*
|
||||
* Does not clear the surface by default, clearing the surface can be done
|
||||
* by passing the CLEAR_BUFFER flag.
|
||||
*/
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for TextureClients that can be updated using YCbCr data.
|
||||
*/
|
||||
@ -214,7 +170,6 @@ public:
|
||||
const gfx::IntSize& aSizeHint);
|
||||
|
||||
virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
|
||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() { return nullptr; }
|
||||
virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
|
||||
|
||||
/**
|
||||
@ -229,6 +184,56 @@ public:
|
||||
|
||||
virtual bool IsLocked() const = 0;
|
||||
|
||||
virtual bool CanExposeDrawTarget() const { return false; }
|
||||
|
||||
/**
|
||||
* Returns a DrawTarget to draw into the TextureClient.
|
||||
*
|
||||
* This must never be called on a TextureClient that is not sucessfully locked.
|
||||
* When called several times within one Lock/Unlock pair, this method should
|
||||
* return the same DrawTarget.
|
||||
* The DrawTarget is automatically flushed by the TextureClient when the latter
|
||||
* is unlocked, and the DrawTarget that will be returned within the next
|
||||
* lock/unlock pair may or may not be the same object.
|
||||
* Do not keep references to the DrawTarget outside of the lock/unlock pair.
|
||||
*
|
||||
* This is typically used as follows:
|
||||
*
|
||||
* if (!texture->Lock(OPEN_READ_WRITE)) {
|
||||
* return false;
|
||||
* }
|
||||
* {
|
||||
* // Restrict this code's scope to ensure all references to dt are gone
|
||||
* // when Unlock is called.
|
||||
* RefPtr<DrawTarget> dt = texture->GetAsDrawTarget();
|
||||
* // use the draw target ...
|
||||
* }
|
||||
* texture->Unlock();
|
||||
*
|
||||
*/
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() { return nullptr; }
|
||||
|
||||
// TextureClients that can expose a DrawTarget should override this method.
|
||||
virtual gfx::SurfaceFormat GetFormat() const
|
||||
{
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates for a given surface size, taking into account the pixel format
|
||||
* which is part of the state of the TextureClient.
|
||||
*
|
||||
* Does not clear the surface by default, clearing the surface can be done
|
||||
* by passing the CLEAR_BUFFER flag.
|
||||
*
|
||||
* TextureClients that can expose a DrawTarget should override this method.
|
||||
*/
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a rectangle from this texture client to a position in aTarget.
|
||||
* It is assumed that the necessary locks are in place; so this should at
|
||||
@ -409,7 +414,6 @@ protected:
|
||||
class BufferTextureClient : public TextureClient
|
||||
, public TextureClientSurface
|
||||
, public TextureClientYCbCr
|
||||
, public TextureClientDrawTarget
|
||||
{
|
||||
public:
|
||||
BufferTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
|
||||
@ -429,6 +433,10 @@ public:
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
|
||||
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientSurface
|
||||
|
||||
virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
|
||||
@ -440,12 +448,6 @@ public:
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientDrawTarget
|
||||
|
||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientYCbCr
|
||||
|
||||
virtual TextureClientYCbCr* AsTextureClientYCbCr() MOZ_OVERRIDE { return this; }
|
||||
|
@ -62,7 +62,7 @@ TextureClientPool::GetTextureClient()
|
||||
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
|
||||
mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
|
||||
}
|
||||
textureClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_DEFAULT);
|
||||
textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);
|
||||
|
||||
return textureClient;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ TileClient::DiscardFrontBuffer()
|
||||
{
|
||||
if (mFrontBuffer) {
|
||||
MOZ_ASSERT(mFrontLock);
|
||||
mManager->GetTexturePool(mFrontBuffer->AsTextureClientDrawTarget()->GetFormat())->ReturnTextureClientDeferred(mFrontBuffer);
|
||||
mManager->GetTexturePool(mFrontBuffer->GetFormat())->ReturnTextureClientDeferred(mFrontBuffer);
|
||||
mFrontLock->ReadUnlock();
|
||||
mFrontBuffer = nullptr;
|
||||
mFrontLock = nullptr;
|
||||
@ -485,7 +485,7 @@ TileClient::DiscardBackBuffer()
|
||||
{
|
||||
if (mBackBuffer) {
|
||||
MOZ_ASSERT(mBackLock);
|
||||
mManager->GetTexturePool(mBackBuffer->AsTextureClientDrawTarget()->GetFormat())->ReturnTextureClient(mBackBuffer);
|
||||
mManager->GetTexturePool(mBackBuffer->GetFormat())->ReturnTextureClient(mBackBuffer);
|
||||
mBackLock->ReadUnlock();
|
||||
mBackBuffer = nullptr;
|
||||
mBackLock = nullptr;
|
||||
@ -751,7 +751,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
|
||||
// We must not keep a reference to the DrawTarget after it has been unlocked,
|
||||
// make sure these are null'd before unlocking as destruction of the context
|
||||
// may cause the target to be flushed.
|
||||
RefPtr<DrawTarget> drawTarget = backBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
||||
RefPtr<DrawTarget> drawTarget = backBuffer->GetAsDrawTarget();
|
||||
drawTarget->SetTransform(Matrix());
|
||||
|
||||
RefPtr<gfxContext> ctxt = new gfxContext(drawTarget);
|
||||
|
@ -195,7 +195,7 @@ TextureClientD3D11::Unlock()
|
||||
MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!");
|
||||
|
||||
if (mDrawTarget) {
|
||||
// see the comment on TextureClientDrawTarget::GetAsDrawTarget.
|
||||
// see the comment on TextureClient::GetAsDrawTarget.
|
||||
// This DrawTarget is internal to the TextureClient and is only exposed to the
|
||||
// outside world between Lock() and Unlock(). This assertion checks that no outside
|
||||
// reference remains by the time Unlock() is called.
|
||||
|
@ -25,8 +25,7 @@ class CompositorD3D11;
|
||||
* A TextureClient to share a D3D10 texture with the compositor thread.
|
||||
* The corresponding TextureHost is DXGITextureHostD3D11
|
||||
*/
|
||||
class TextureClientD3D11 : public TextureClient,
|
||||
public TextureClientDrawTarget
|
||||
class TextureClientD3D11 : public TextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientD3D11(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
@ -53,11 +52,9 @@ public:
|
||||
|
||||
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE { return nullptr; }
|
||||
|
||||
// TextureClientDrawTarget
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -185,7 +185,6 @@ protected:
|
||||
* The corresponding TextureHost is TextureHostD3D9.
|
||||
*/
|
||||
class CairoTextureClientD3D9 : public TextureClient
|
||||
, public TextureClientDrawTarget
|
||||
{
|
||||
public:
|
||||
CairoTextureClientD3D9(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
@ -210,10 +209,6 @@ public:
|
||||
|
||||
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientDrawTarget
|
||||
|
||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
@ -239,7 +234,6 @@ private:
|
||||
* The coresponding TextureHost is DIBTextureHostD3D9.
|
||||
*/
|
||||
class DIBTextureClientD3D9 : public TextureClient
|
||||
, public TextureClientDrawTarget
|
||||
{
|
||||
public:
|
||||
DIBTextureClientD3D9(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
@ -264,9 +258,7 @@ public:
|
||||
|
||||
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientDrawTarget
|
||||
|
||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -64,6 +64,16 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
|
||||
{
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags) MOZ_OVERRIDE
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
gl::SharedTextureHandle mHandle;
|
||||
gfx::IntSize mSize;
|
||||
@ -100,6 +110,16 @@ public:
|
||||
|
||||
virtual gfx::IntSize GetSize() const { return gfx::IntSize(); }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
|
||||
{
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags) MOZ_OVERRIDE
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool mIsLocked;
|
||||
RefPtr<gfx::SurfaceStream> mStream;
|
||||
|
Loading…
Reference in New Issue
Block a user