Bug 1102917 - Remove the TextureInfo member from client compositables. r=sotaro

This commit is contained in:
Nicolas Silva 2014-11-25 20:19:13 +01:00
Родитель a491a3acfe
Коммит 49d7294bfb
5 изменённых файлов: 25 добавлений и 26 удалений

Просмотреть файл

@ -224,10 +224,11 @@ struct TextureInfo
, mTextureFlags(TextureFlags::NO_FLAGS)
{}
explicit TextureInfo(CompositableType aType)
explicit TextureInfo(CompositableType aType,
TextureFlags aTextureFlags = TextureFlags::DEFAULT)
: mCompositableType(aType)
, mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
, mTextureFlags(TextureFlags::NO_FLAGS)
, mTextureFlags(aTextureFlags)
{}
bool operator==(const TextureInfo& aOther) const

Просмотреть файл

@ -127,7 +127,7 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
// the most effective way to make this work.
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
aFormat, aSize, BackendType::CAIRO,
mTextureInfo.mTextureFlags | aFlags);
mTextureFlags | aFlags);
}
gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
@ -138,7 +138,7 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
// to use double buffering.
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
aFormat, aSize, backend,
mTextureInfo.mTextureFlags | aFlags);
mTextureFlags | aFlags);
#endif
}

Просмотреть файл

@ -54,7 +54,7 @@ public:
CanvasClient(CompositableForwarder* aFwd, TextureFlags aFlags)
: CompositableClient(aFwd, aFlags)
{
mTextureInfo.mTextureFlags = aFlags;
mTextureFlags = aFlags;
}
virtual ~CanvasClient() {}
@ -64,9 +64,6 @@ public:
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
virtual void Updated() { }
protected:
TextureInfo mTextureInfo;
};
// Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
@ -81,7 +78,7 @@ public:
TextureInfo GetTextureInfo() const
{
return TextureInfo(CompositableType::IMAGE);
return TextureInfo(CompositableType::IMAGE, mTextureFlags);
}
virtual void Clear() MOZ_OVERRIDE
@ -93,7 +90,7 @@ public:
virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE
{
MOZ_ASSERT((mTextureInfo.mTextureFlags & aTexture->GetFlags()) == mTextureInfo.mTextureFlags);
MOZ_ASSERT((mTextureFlags & aTexture->GetFlags()) == mTextureFlags);
return CompositableClient::AddTextureClient(aTexture);
}

Просмотреть файл

@ -282,10 +282,10 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
mSurfaceFormat = aFormat;
mSize = gfx::IntSize(aRect.width, aRect.height);
mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (aFlags & BUFFER_COMPONENT_ALPHA) {
mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
}
CreateBackBuffer(mBufferRect);
@ -297,7 +297,7 @@ ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
// gfx::BackendType::NONE means fallback to the content backend
mTextureClient = CreateTextureClientForDrawing(
mSurfaceFormat, mSize, gfx::BackendType::NONE,
mTextureInfo.mTextureFlags,
mTextureFlags,
TextureAllocationFlags::ALLOC_CLEAR_BUFFER
);
if (!mTextureClient || !AddTextureClient(mTextureClient)) {
@ -305,9 +305,9 @@ ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
return;
}
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
if (mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
mTextureClientOnWhite = mTextureClient->CreateSimilar(
mTextureInfo.mTextureFlags,
mTextureFlags,
TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE
);
if (!mTextureClientOnWhite || !AddTextureClient(mTextureClientOnWhite)) {

Просмотреть файл

@ -253,11 +253,6 @@ public:
virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return mTextureInfo;
}
protected:
void DestroyBuffers();
@ -271,7 +266,6 @@ protected:
void CreateBackBuffer(const nsIntRect& aBufferRect);
// Ensure we have a valid back buffer if we have a valid front buffer (i.e.
// if a backbuffer has been created.)
virtual void EnsureBackBufferIfFrontBuffer() {}
@ -294,7 +288,6 @@ protected:
// painting.
nsTArray<RefPtr<TextureClient> > mOldTextures;
TextureInfo mTextureInfo;
bool mIsNewBuffer;
bool mFrontAndBackBufferDiffer;
gfx::IntSize mSize;
@ -317,9 +310,8 @@ class ContentClientDoubleBuffered : public ContentClientRemoteBuffer
public:
explicit ContentClientDoubleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = CompositableType::CONTENT_DOUBLE;
}
{}
virtual ~ContentClientDoubleBuffered() {}
virtual void Clear() MOZ_OVERRIDE
@ -341,6 +333,11 @@ public:
virtual void EnsureBackBufferIfFrontBuffer() MOZ_OVERRIDE;
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(CompositableType::CONTENT_DOUBLE, mTextureFlags);
}
protected:
virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
@ -377,11 +374,15 @@ public:
explicit ContentClientSingleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = CompositableType::CONTENT_SINGLE;
}
virtual ~ContentClientSingleBuffered() {}
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) MOZ_OVERRIDE;
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(CompositableType::CONTENT_SINGLE, mTextureFlags);
}
};
/**