From 8e5bb9bcd27198e79c2994ddbea37bf1ae10669a Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Thu, 10 Apr 2014 10:14:28 +0200 Subject: [PATCH] Bug 990871 - Move TextureClientDrawTarget into TextureClient. r=mattwoodrow --- gfx/layers/ImageContainer.cpp | 6 +- gfx/layers/RotatedBuffer.cpp | 6 +- gfx/layers/basic/TextureClientX11.h | 6 +- gfx/layers/client/CanvasClient.cpp | 2 +- gfx/layers/client/ContentClient.cpp | 13 +-- gfx/layers/client/ImageClient.cpp | 6 +- gfx/layers/client/SimpleTextureClientPool.cpp | 2 +- .../client/SimpleTiledContentClient.cpp | 2 +- gfx/layers/client/TextureClient.cpp | 11 +- gfx/layers/client/TextureClient.h | 106 +++++++++--------- gfx/layers/client/TextureClientPool.cpp | 2 +- gfx/layers/client/TiledContentClient.cpp | 6 +- gfx/layers/d3d11/TextureD3D11.h | 7 +- gfx/layers/d3d9/TextureD3D9.h | 12 +- gfx/layers/opengl/TextureClientOGL.h | 20 ++++ 15 files changed, 107 insertions(+), 100 deletions(-) diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index 0c2ac81267d5..1e8f744ef671 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -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 dt = textureClient->AsTextureClientDrawTarget()->GetAsDrawTarget(); + RefPtr dt = textureClient->GetAsDrawTarget(); dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint()); } diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index e3b0c5f70fe5..8d5d67c68433 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -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(); } } diff --git a/gfx/layers/basic/TextureClientX11.h b/gfx/layers/basic/TextureClientX11.h index 8a9c14693f5e..a5afe195a343 100644 --- a/gfx/layers/basic/TextureClientX11.h +++ b/gfx/layers/basic/TextureClientX11.h @@ -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 GetAsSurface() MOZ_OVERRIDE; bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE; - // TextureClientDrawTarget - TemporaryRef GetAsDrawTarget() MOZ_OVERRIDE; gfx::SurfaceFormat GetFormat() const { return mFormat; diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 35902fb5966b..9eedd2f73786 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -88,7 +88,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) { // Restrict drawTarget to a scope so that terminates before Unlock. RefPtr target = - mBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget(); + mBuffer->GetAsDrawTarget(); if (target) { aLayer->UpdateTarget(target); updated = true; diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 2487cd680ca0..a69999f995d0 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -195,7 +195,7 @@ ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr& 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& 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 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 dt = - mFrontClient->AsTextureClientDrawTarget()->GetAsDrawTarget(); + RefPtr dt = mFrontClient->GetAsDrawTarget(); RefPtr dtOnWhite = mFrontClientOnWhite - ? mFrontClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget() + ? mFrontClientOnWhite->GetAsDrawTarget() : nullptr; RotatedBuffer frontBuffer(dt, dtOnWhite, diff --git a/gfx/layers/client/ImageClient.cpp b/gfx/layers/client/ImageClient.cpp index 82d12d902b67..274c86dc7a0f 100644 --- a/gfx/layers/client/ImageClient.cpp +++ b/gfx/layers/client/ImageClient.cpp @@ -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 dt = mFrontBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget(); + RefPtr dt = mFrontBuffer->GetAsDrawTarget(); MOZ_ASSERT(surface.get()); dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint()); } diff --git a/gfx/layers/client/SimpleTextureClientPool.cpp b/gfx/layers/client/SimpleTextureClientPool.cpp index 2f650f061186..354bebdc9e0e 100644 --- a/gfx/layers/client/SimpleTextureClientPool.cpp +++ b/gfx/layers/client/SimpleTextureClientPool.cpp @@ -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()); diff --git a/gfx/layers/client/SimpleTiledContentClient.cpp b/gfx/layers/client/SimpleTiledContentClient.cpp index 2d022fc1a302..59393333a421 100644 --- a/gfx/layers/client/SimpleTiledContentClient.cpp +++ b/gfx/layers/client/SimpleTiledContentClient.cpp @@ -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); diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index bc7cddb584f1..028c5bf33989 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -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 destinationTarget = aTarget->AsTextureClientDrawTarget()->GetAsDrawTarget(); - RefPtr sourceTarget = AsTextureClientDrawTarget()->GetAsDrawTarget(); + RefPtr destinationTarget = aTarget->GetAsDrawTarget(); + RefPtr sourceTarget = GetAsDrawTarget(); RefPtr 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. diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 6ccb06e5655d..02d1e247d5cd 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -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 dt = texture->AsTextureClientDrawTarget()->GetAsDrawTarget(); - * // use the draw target ... - * } - * texture->Unlock(); - * - */ - virtual TemporaryRef 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 dt = texture->GetAsDrawTarget(); + * // use the draw target ... + * } + * texture->Unlock(); + * + */ + virtual TemporaryRef 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 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 GetAsDrawTarget() MOZ_OVERRIDE; - // TextureClientYCbCr virtual TextureClientYCbCr* AsTextureClientYCbCr() MOZ_OVERRIDE { return this; } diff --git a/gfx/layers/client/TextureClientPool.cpp b/gfx/layers/client/TextureClientPool.cpp index ecf2b5c1708d..ed5a7536e1c7 100644 --- a/gfx/layers/client/TextureClientPool.cpp +++ b/gfx/layers/client/TextureClientPool.cpp @@ -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; } diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index eaeb03a71738..3a173d4535a5 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -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 = backBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget(); + RefPtr drawTarget = backBuffer->GetAsDrawTarget(); drawTarget->SetTransform(Matrix()); RefPtr ctxt = new gfxContext(drawTarget); diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index 4a921c4d6221..9a22ec151c25 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -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 GetAsDrawTarget() MOZ_OVERRIDE; diff --git a/gfx/layers/d3d9/TextureD3D9.h b/gfx/layers/d3d9/TextureD3D9.h index 7446aec0463c..72a7566ddf99 100644 --- a/gfx/layers/d3d9/TextureD3D9.h +++ b/gfx/layers/d3d9/TextureD3D9.h @@ -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 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 GetAsDrawTarget() MOZ_OVERRIDE; @@ -395,6 +387,8 @@ public: virtual void Updated(const nsIntRegion* aRegion = nullptr); + virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; } + virtual TemporaryRef GetAsSurface() MOZ_OVERRIDE { return nullptr; // TODO: cf bug 872568 diff --git a/gfx/layers/opengl/TextureClientOGL.h b/gfx/layers/opengl/TextureClientOGL.h index 9d617001235d..903059c1ab09 100644 --- a/gfx/layers/opengl/TextureClientOGL.h +++ b/gfx/layers/opengl/TextureClientOGL.h @@ -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 mStream;