зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1143575. Pass a picture rect with OpUseOverlaySource and OpUseTexture, and eliminate OpUpdatePictureRect. r=nical
The picture rect logically belongs with the texture, and later patches will make OpUseTexture take multiple textures, each of which needs its own picture rect. --HG-- extra : commitid : AF2YszcgNe1 extra : rebase_source : 826332fc5dfec25b712ff62e5812cb00aaac81a4
This commit is contained in:
Родитель
27ae3dd82a
Коммит
942ed20877
|
@ -245,9 +245,8 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag
|
|||
}
|
||||
|
||||
mFrontBuffer = texture;
|
||||
GetForwarder()->UseTexture(this, texture);
|
||||
|
||||
UpdatePictureRect(image->GetPictureRect());
|
||||
IntRect pictureRect = image->GetPictureRect();
|
||||
GetForwarder()->UseTexture(this, texture, &pictureRect);
|
||||
|
||||
mLastPaintedImageSerial = image->GetSerial();
|
||||
aContainer->NotifyPaintedImage(image);
|
||||
|
@ -278,17 +277,6 @@ ImageClient::ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags,
|
|||
, mLastPaintedImageSerial(0)
|
||||
{}
|
||||
|
||||
void
|
||||
ImageClient::UpdatePictureRect(IntRect aRect)
|
||||
{
|
||||
if (mPictureRect == aRect) {
|
||||
return;
|
||||
}
|
||||
mPictureRect = aRect;
|
||||
MOZ_ASSERT(mForwarder);
|
||||
GetForwarder()->UpdatePictureRect(this, aRect);
|
||||
}
|
||||
|
||||
ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
|
||||
TextureFlags aFlags)
|
||||
: ImageClient(aFwd, aFlags, CompositableType::IMAGE_BRIDGE)
|
||||
|
@ -364,9 +352,8 @@ ImageClientOverlay::UpdateImage(ImageContainer* aContainer, uint32_t aContentFla
|
|||
OverlaySource source;
|
||||
source.handle() = OverlayHandle(overlayId);
|
||||
source.size() = size;
|
||||
GetForwarder()->UseOverlaySource(this, source);
|
||||
GetForwarder()->UseOverlaySource(this, source, image->GetPictureRect());
|
||||
}
|
||||
UpdatePictureRect(image->GetPictureRect());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,6 @@ public:
|
|||
*/
|
||||
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) = 0;
|
||||
|
||||
/**
|
||||
* The picture rect is the area of the texture which makes up the image. That
|
||||
* is, the area that should be composited. In texture space.
|
||||
*/
|
||||
virtual void UpdatePictureRect(gfx::IntRect aPictureRect);
|
||||
|
||||
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) = 0;
|
||||
|
||||
void SetLayer(ClientLayer* aLayer) { mLayer = aLayer; }
|
||||
|
@ -91,7 +85,6 @@ protected:
|
|||
ClientLayer* mLayer;
|
||||
CompositableType mType;
|
||||
int32_t mLastPaintedImageSerial;
|
||||
gfx::IntRect mPictureRect;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include "mozilla/layers/PCompositableParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
namespace layers {
|
||||
|
||||
class Compositor;
|
||||
|
@ -104,7 +107,8 @@ CompositableHost::FromIPDLActor(PCompositableParent* aActor)
|
|||
}
|
||||
|
||||
void
|
||||
CompositableHost::UseTextureHost(TextureHost* aTexture)
|
||||
CompositableHost::UseTextureHost(TextureHost* aTexture,
|
||||
const IntRect& aPictureRect)
|
||||
{
|
||||
if (!aTexture) {
|
||||
return;
|
||||
|
|
|
@ -98,16 +98,15 @@ public:
|
|||
|
||||
/**
|
||||
* Returns the front buffer.
|
||||
* *aPictureRect (if non-null, and the returned TextureHost is non-null)
|
||||
* is set to the picture rect.
|
||||
*/
|
||||
virtual TextureHost* GetAsTextureHost() { return nullptr; }
|
||||
virtual TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual LayerRenderState GetRenderState() = 0;
|
||||
|
||||
virtual void SetPictureRect(const gfx::IntRect& aPictureRect)
|
||||
{
|
||||
MOZ_ASSERT(false, "Should have been overridden");
|
||||
}
|
||||
|
||||
virtual gfx::IntSize GetImageSize() const
|
||||
{
|
||||
MOZ_ASSERT(false, "Should have been overridden");
|
||||
|
@ -153,9 +152,10 @@ public:
|
|||
mKeepAttached = aFlags & KEEP_ATTACHED;
|
||||
|
||||
// If we already have a textureHost before, use that in this moment.
|
||||
RefPtr<TextureHost> frontBuffer = GetAsTextureHost();
|
||||
gfx::IntRect pictureRect;
|
||||
RefPtr<TextureHost> frontBuffer = GetAsTextureHost(&pictureRect);
|
||||
if (frontBuffer) {
|
||||
UseTextureHost(frontBuffer);
|
||||
UseTextureHost(frontBuffer, pictureRect);
|
||||
}
|
||||
}
|
||||
// Detach this compositable host from its layer.
|
||||
|
@ -187,10 +187,12 @@ public:
|
|||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) = 0;
|
||||
|
||||
virtual void UseTextureHost(TextureHost* aTexture);
|
||||
virtual void UseTextureHost(TextureHost* aTexture,
|
||||
const gfx::IntRect& aPictureRect);
|
||||
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
|
||||
TextureHost* aTextureOnWhite);
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay) { }
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay,
|
||||
const gfx::IntRect& aPictureRect) { }
|
||||
|
||||
virtual void RemoveTextureHost(TextureHost* aTexture);
|
||||
|
||||
|
|
|
@ -218,9 +218,13 @@ ContentHostTexture::Composite(EffectChain& aEffectChain,
|
|||
}
|
||||
|
||||
void
|
||||
ContentHostTexture::UseTextureHost(TextureHost* aTexture)
|
||||
ContentHostTexture::UseTextureHost(TextureHost* aTexture,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
ContentHostBase::UseTextureHost(aTexture);
|
||||
ContentHostBase::UseTextureHost(aTexture, aPictureRect);
|
||||
MOZ_ASSERT(aPictureRect.IsEqualInterior(
|
||||
nsIntRect(nsIntPoint(0, 0), nsIntSize(aTexture->GetSize()))),
|
||||
"Only default picture rect supported");
|
||||
mTextureHost = aTexture;
|
||||
mTextureHostOnWhite = nullptr;
|
||||
mTextureSourceOnWhite = nullptr;
|
||||
|
|
|
@ -131,7 +131,8 @@ public:
|
|||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
||||
|
||||
virtual void UseTextureHost(TextureHost* aTexture) override;
|
||||
virtual void UseTextureHost(TextureHost* aTexture,
|
||||
const nsIntRect& aPictureRect) override;
|
||||
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
|
||||
TextureHost* aTextureOnWhite) override;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ class ISurfaceAllocator;
|
|||
|
||||
ImageHost::ImageHost(const TextureInfo& aTextureInfo)
|
||||
: CompositableHost(aTextureInfo)
|
||||
, mHasPictureRect(false)
|
||||
, mLocked(false)
|
||||
{}
|
||||
|
||||
|
@ -37,14 +36,16 @@ ImageHost::~ImageHost()
|
|||
{}
|
||||
|
||||
void
|
||||
ImageHost::UseTextureHost(TextureHost* aTexture)
|
||||
ImageHost::UseTextureHost(TextureHost* aTexture,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
CompositableHost::UseTextureHost(aTexture);
|
||||
CompositableHost::UseTextureHost(aTexture, aPictureRect);
|
||||
mFrontBuffer = aTexture;
|
||||
if (mFrontBuffer) {
|
||||
mFrontBuffer->Updated();
|
||||
mFrontBuffer->PrepareTextureSource(mTextureSource);
|
||||
}
|
||||
mPictureRect = aPictureRect;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -59,8 +60,11 @@ ImageHost::RemoveTextureHost(TextureHost* aTexture)
|
|||
}
|
||||
|
||||
TextureHost*
|
||||
ImageHost::GetAsTextureHost()
|
||||
ImageHost::GetAsTextureHost(IntRect* aPictureRect)
|
||||
{
|
||||
if (aPictureRect) {
|
||||
*aPictureRect = mPictureRect;
|
||||
}
|
||||
return mFrontBuffer;
|
||||
}
|
||||
|
||||
|
@ -112,14 +116,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
}
|
||||
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
IntSize textureSize = mTextureSource->GetSize();
|
||||
gfx::Rect gfxPictureRect
|
||||
= mHasPictureRect ? gfx::Rect(0, 0, mPictureRect.width, mPictureRect.height)
|
||||
: gfx::Rect(0, 0, textureSize.width, textureSize.height);
|
||||
|
||||
gfx::Rect pictureRect(0, 0,
|
||||
mPictureRect.width,
|
||||
mPictureRect.height);
|
||||
gfx::Rect pictureRect(0, 0, mPictureRect.width, mPictureRect.height);
|
||||
BigImageIterator* it = mTextureSource->AsBigImageIterator();
|
||||
if (it) {
|
||||
|
||||
|
@ -143,15 +140,11 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
do {
|
||||
IntRect tileRect = it->GetTileRect();
|
||||
gfx::Rect rect(tileRect.x, tileRect.y, tileRect.width, tileRect.height);
|
||||
if (mHasPictureRect) {
|
||||
rect = rect.Intersect(pictureRect);
|
||||
effect->mTextureCoords = Rect(Float(rect.x - tileRect.x)/ tileRect.width,
|
||||
Float(rect.y - tileRect.y) / tileRect.height,
|
||||
Float(rect.width) / tileRect.width,
|
||||
Float(rect.height) / tileRect.height);
|
||||
} else {
|
||||
effect->mTextureCoords = Rect(0, 0, 1, 1);
|
||||
}
|
||||
rect = rect.Intersect(pictureRect);
|
||||
effect->mTextureCoords = Rect(Float(rect.x - tileRect.x) / tileRect.width,
|
||||
Float(rect.y - tileRect.y) / tileRect.height,
|
||||
Float(rect.width) / tileRect.width,
|
||||
Float(rect.height) / tileRect.height);
|
||||
if (mFrontBuffer->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
|
@ -163,32 +156,24 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
} while (it->NextTile());
|
||||
it->EndBigImageIteration();
|
||||
// layer border
|
||||
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
|
||||
gfxPictureRect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE, pictureRect,
|
||||
aClipRect, aTransform, mFlashCounter);
|
||||
} else {
|
||||
IntSize textureSize = mTextureSource->GetSize();
|
||||
gfx::Rect rect;
|
||||
if (mHasPictureRect) {
|
||||
effect->mTextureCoords = Rect(Float(mPictureRect.x) / textureSize.width,
|
||||
Float(mPictureRect.y) / textureSize.height,
|
||||
Float(mPictureRect.width) / textureSize.width,
|
||||
Float(mPictureRect.height) / textureSize.height);
|
||||
rect = pictureRect;
|
||||
} else {
|
||||
effect->mTextureCoords = Rect(0, 0, 1, 1);
|
||||
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
|
||||
}
|
||||
effect->mTextureCoords = Rect(Float(mPictureRect.x) / textureSize.width,
|
||||
Float(mPictureRect.y) / textureSize.height,
|
||||
Float(mPictureRect.width) / textureSize.width,
|
||||
Float(mPictureRect.height) / textureSize.height);
|
||||
|
||||
if (mFrontBuffer->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
|
||||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
GetCompositor()->DrawQuad(pictureRect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
|
||||
rect, aClipRect,
|
||||
pictureRect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
|
@ -274,14 +259,9 @@ ImageHost::Unlock()
|
|||
IntSize
|
||||
ImageHost::GetImageSize() const
|
||||
{
|
||||
if (mHasPictureRect) {
|
||||
if (mFrontBuffer) {
|
||||
return IntSize(mPictureRect.width, mPictureRect.height);
|
||||
}
|
||||
|
||||
if (mFrontBuffer) {
|
||||
return mFrontBuffer->GetSize();
|
||||
}
|
||||
|
||||
return IntSize();
|
||||
}
|
||||
|
||||
|
@ -305,7 +285,6 @@ ImageHost::GenEffect(const gfx::Filter& aFilter)
|
|||
#ifdef MOZ_WIDGET_GONK
|
||||
ImageHostOverlay::ImageHostOverlay(const TextureInfo& aTextureInfo)
|
||||
: CompositableHost(aTextureInfo)
|
||||
, mHasPictureRect(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -334,13 +313,8 @@ ImageHostOverlay::Composite(EffectChain& aEffectChain,
|
|||
gfx::Rect rect;
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y,
|
||||
aClipRect.width, aClipRect.height);
|
||||
if (mHasPictureRect) {
|
||||
rect.SetRect(mPictureRect.x, mPictureRect.y,
|
||||
mPictureRect.width, mPictureRect.height);
|
||||
} else {
|
||||
rect.SetRect(0, 0,
|
||||
mOverlay.size().width, mOverlay.size().height);
|
||||
}
|
||||
rect.SetRect(mPictureRect.x, mPictureRect.y,
|
||||
mPictureRect.width, mPictureRect.height);
|
||||
|
||||
mCompositor->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
|
||||
mCompositor->DrawDiagnostics(DiagnosticFlags::IMAGE | DiagnosticFlags::BIGIMAGE,
|
||||
|
@ -358,19 +332,17 @@ ImageHostOverlay::GetRenderState()
|
|||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::UseOverlaySource(OverlaySource aOverlay)
|
||||
ImageHostOverlay::UseOverlaySource(OverlaySource aOverlay,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
mOverlay = aOverlay;
|
||||
mPictureRect = aPictureRect;
|
||||
}
|
||||
|
||||
IntSize
|
||||
ImageHostOverlay::GetImageSize() const
|
||||
{
|
||||
if (mHasPictureRect) {
|
||||
return IntSize(mPictureRect.width, mPictureRect.height);
|
||||
}
|
||||
|
||||
return IntSize();
|
||||
return IntSize(mPictureRect.width, mPictureRect.height);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -51,20 +51,15 @@ public:
|
|||
const gfx::Rect& aClipRect,
|
||||
const nsIntRegion* aVisibleRegion = nullptr) override;
|
||||
|
||||
virtual void UseTextureHost(TextureHost* aTexture) override;
|
||||
virtual void UseTextureHost(TextureHost* aTexture,
|
||||
const nsIntRect& aPictureRect) override;
|
||||
|
||||
virtual void RemoveTextureHost(TextureHost* aTexture) override;
|
||||
|
||||
virtual TextureHost* GetAsTextureHost() override;
|
||||
virtual TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) override;
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) override;
|
||||
|
||||
virtual void SetPictureRect(const gfx::IntRect& aPictureRect) override
|
||||
{
|
||||
mPictureRect = aPictureRect;
|
||||
mHasPictureRect = true;
|
||||
}
|
||||
|
||||
gfx::IntSize GetImageSize() const override;
|
||||
|
||||
virtual LayerRenderState GetRenderState() override;
|
||||
|
@ -88,7 +83,6 @@ protected:
|
|||
CompositableTextureHostRef mFrontBuffer;
|
||||
CompositableTextureSourceRef mTextureSource;
|
||||
gfx::IntRect mPictureRect;
|
||||
bool mHasPictureRect;
|
||||
bool mLocked;
|
||||
};
|
||||
|
||||
|
@ -111,17 +105,12 @@ public:
|
|||
const gfx::Rect& aClipRect,
|
||||
const nsIntRegion* aVisibleRegion = nullptr) override;
|
||||
virtual LayerRenderState GetRenderState() override;
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay) override;
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay,
|
||||
const gfx::IntRect& aPictureRect) override;
|
||||
virtual gfx::IntSize GetImageSize() const override;
|
||||
virtual void SetPictureRect(const nsIntRect& aPictureRect) override
|
||||
{
|
||||
mPictureRect = aPictureRect;
|
||||
mHasPictureRect = true;
|
||||
}
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
||||
protected:
|
||||
gfx::IntRect mPictureRect;
|
||||
bool mHasPictureRect;
|
||||
OverlaySource mOverlay;
|
||||
};
|
||||
|
||||
|
|
|
@ -72,15 +72,10 @@ public:
|
|||
const ThebesBufferData& aThebesBufferData,
|
||||
const nsIntRegion& aUpdatedRegion) = 0;
|
||||
|
||||
/**
|
||||
* Communicate the picture rect of a YUV image in aLayer to the compositor
|
||||
*/
|
||||
virtual void UpdatePictureRect(CompositableClient* aCompositable,
|
||||
const gfx::IntRect& aRect) = 0;
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
virtual void UseOverlaySource(CompositableClient* aCompositabl,
|
||||
const OverlaySource& aOverlay) = 0;
|
||||
const OverlaySource& aOverlay,
|
||||
const gfx::IntRect& aPictureRect) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -136,9 +131,13 @@ public:
|
|||
/**
|
||||
* Tell the CompositableHost on the compositor side what texture to use for
|
||||
* the next composition.
|
||||
* If non-null, aPictureRect is the area of the texture which makes up the
|
||||
* image. That is, the area that should be composited. In texture space.
|
||||
* When aPictureRect is null, the entire area of the texture is used.
|
||||
*/
|
||||
virtual void UseTexture(CompositableClient* aCompositable,
|
||||
TextureClient* aClient) = 0;
|
||||
TextureClient* aClient,
|
||||
const nsIntRect* aPictureRect = nullptr) = 0;
|
||||
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
|
||||
TextureClient* aClientOnBlack,
|
||||
TextureClient* aClientOnWhite) = 0;
|
||||
|
|
|
@ -68,6 +68,15 @@ bool ScheduleComposition(const T& op)
|
|||
return true;
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || defined(MOZ_WIDGET_GONK)
|
||||
static bool ValidatePictureRect(const mozilla::gfx::IntSize& aSize,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
return nsIntRect(0, 0, aSize.width, aSize.height).Contains(aPictureRect) &&
|
||||
!aPictureRect.IsEmpty();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation& aEdit,
|
||||
EditReplyVector& replyv)
|
||||
|
@ -102,13 +111,6 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
|||
RenderTraceInvalidateEnd(thebes, "FF00FF");
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpUpdatePictureRect: {
|
||||
const OpUpdatePictureRect& op = aEdit.get_OpUpdatePictureRect();
|
||||
CompositableHost* compositable = AsCompositable(op);
|
||||
MOZ_ASSERT(compositable);
|
||||
compositable->SetPictureRect(op.picture());
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpUseTiledLayerBuffer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
||||
const OpUseTiledLayerBuffer& op = aEdit.get_OpUseTiledLayerBuffer();
|
||||
|
@ -172,7 +174,10 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
|||
RefPtr<TextureHost> tex = TextureHost::AsTextureHost(op.textureParent());
|
||||
|
||||
MOZ_ASSERT(tex.get());
|
||||
compositable->UseTextureHost(tex);
|
||||
if (!ValidatePictureRect(tex->GetSize(), op.picture())) {
|
||||
return false;
|
||||
}
|
||||
compositable->UseTextureHost(tex, op.picture());
|
||||
|
||||
MaybeFence maybeFence = op.fence();
|
||||
if (maybeFence.type() == MaybeFence::TFenceHandle) {
|
||||
|
@ -209,7 +214,10 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
|||
const OpUseOverlaySource& op = aEdit.get_OpUseOverlaySource();
|
||||
CompositableHost* compositable = AsCompositable(op);
|
||||
MOZ_ASSERT(compositable->GetType() == CompositableType::IMAGE_OVERLAY, "Invalid operation!");
|
||||
compositable->UseOverlaySource(op.overlay());
|
||||
if (!ValidatePictureRect(op.overlay().size(), op.picture())) {
|
||||
return false;
|
||||
}
|
||||
compositable->UseOverlaySource(op.overlay(), op.picture());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -108,7 +108,8 @@ struct AutoEndTransaction {
|
|||
|
||||
void
|
||||
ImageBridgeChild::UseTexture(CompositableClient* aCompositable,
|
||||
TextureClient* aTexture)
|
||||
TextureClient* aTexture,
|
||||
const gfx::IntRect* aPictureRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
MOZ_ASSERT(aTexture);
|
||||
|
@ -116,9 +117,12 @@ ImageBridgeChild::UseTexture(CompositableClient* aCompositable,
|
|||
MOZ_ASSERT(aTexture->GetIPDLActor());
|
||||
|
||||
FenceHandle fence = aTexture->GetAcquireFenceHandle();
|
||||
IntRect pictureRect = aPictureRect ? *aPictureRect :
|
||||
IntRect(IntPoint(0, 0), IntSize(aTexture->GetSize()));
|
||||
mTxn->AddNoSwapEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor(),
|
||||
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t())));
|
||||
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
|
||||
pictureRect));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -141,22 +145,15 @@ ImageBridgeChild::UseComponentAlphaTextures(CompositableClient* aCompositable,
|
|||
#ifdef MOZ_WIDGET_GONK
|
||||
void
|
||||
ImageBridgeChild::UseOverlaySource(CompositableClient* aCompositable,
|
||||
const OverlaySource& aOverlay)
|
||||
const OverlaySource& aOverlay,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(), aOverlay));
|
||||
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(),
|
||||
aOverlay, aPictureRect));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable,
|
||||
const gfx::IntRect& aRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
||||
mTxn->AddNoSwapEdit(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
|
||||
}
|
||||
|
||||
// Singleton
|
||||
static StaticRefPtr<ImageBridgeChild> sImageBridgeChildSingleton;
|
||||
static StaticRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
|
||||
|
|
|
@ -220,13 +220,15 @@ public:
|
|||
* See CompositableForwarder::UseTexture
|
||||
*/
|
||||
virtual void UseTexture(CompositableClient* aCompositable,
|
||||
TextureClient* aClient) override;
|
||||
TextureClient* aClient,
|
||||
const nsIntRect* aPictureRect = nullptr) override;
|
||||
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
|
||||
TextureClient* aClientOnBlack,
|
||||
TextureClient* aClientOnWhite) override;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
virtual void UseOverlaySource(CompositableClient* aCompositable,
|
||||
const OverlaySource& aOverlay) override;
|
||||
const OverlaySource& aOverlay,
|
||||
const nsIntRect& aPictureRect) override;
|
||||
#endif
|
||||
|
||||
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
|
||||
|
@ -244,13 +246,6 @@ public:
|
|||
NS_RUNTIMEABORT("should not be called");
|
||||
}
|
||||
|
||||
/**
|
||||
* Communicate the picture rect of a YUV image in aLayer to the compositor
|
||||
*/
|
||||
virtual void UpdatePictureRect(CompositableClient* aCompositable,
|
||||
const gfx::IntRect& aRect) override;
|
||||
|
||||
|
||||
virtual void UpdateTextureRegion(CompositableClient* aCompositable,
|
||||
const ThebesBufferData& aThebesBufferData,
|
||||
const nsIntRegion& aUpdatedRegion) override {
|
||||
|
|
|
@ -349,6 +349,7 @@ struct OpUseTiledLayerBuffer {
|
|||
struct OpUseOverlaySource {
|
||||
PCompositable compositable;
|
||||
OverlaySource overlay;
|
||||
IntRect picture;
|
||||
};
|
||||
|
||||
struct OpPaintTextureRegion {
|
||||
|
@ -357,11 +358,6 @@ struct OpPaintTextureRegion {
|
|||
nsIntRegion updatedRegion;
|
||||
};
|
||||
|
||||
struct OpUpdatePictureRect {
|
||||
PCompositable compositable;
|
||||
IntRect picture;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tells the CompositableHost to remove the corresponding TextureHost
|
||||
*/
|
||||
|
@ -395,6 +391,7 @@ struct OpUseTexture {
|
|||
PCompositable compositable;
|
||||
PTexture texture;
|
||||
MaybeFence fence;
|
||||
IntRect picture;
|
||||
};
|
||||
|
||||
struct OpUseComponentAlphaTextures {
|
||||
|
@ -420,8 +417,6 @@ struct OpDeliverFenceToTracker {
|
|||
};
|
||||
|
||||
union CompositableOperation {
|
||||
OpUpdatePictureRect;
|
||||
|
||||
OpPaintTextureRegion;
|
||||
|
||||
OpUseTiledLayerBuffer;
|
||||
|
|
|
@ -39,8 +39,9 @@ class Shmem;
|
|||
|
||||
namespace layers {
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::gl;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
class ClientTiledLayerBuffer;
|
||||
|
||||
|
@ -348,18 +349,10 @@ ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
|
|||
aUpdatedRegion));
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable,
|
||||
const gfx::IntRect& aRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
||||
mTxn->AddNoSwapPaint(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
|
||||
TextureClient* aTexture)
|
||||
TextureClient* aTexture,
|
||||
const nsIntRect* aPictureRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
MOZ_ASSERT(aTexture);
|
||||
|
@ -367,9 +360,12 @@ ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
|
|||
MOZ_ASSERT(aTexture->GetIPDLActor());
|
||||
|
||||
FenceHandle fence = aTexture->GetAcquireFenceHandle();
|
||||
IntRect pictureRect = aPictureRect ? *aPictureRect :
|
||||
IntRect(nsIntPoint(0, 0), IntSize(aTexture->GetSize()));
|
||||
mTxn->AddEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor(),
|
||||
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t())));
|
||||
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
|
||||
pictureRect));
|
||||
if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD
|
||||
&& aTexture->HasInternalBuffer()) {
|
||||
// We use IMMEDIATE_UPLOAD when we want to be sure that the upload cannot
|
||||
|
@ -399,10 +395,12 @@ ShadowLayerForwarder::UseComponentAlphaTextures(CompositableClient* aCompositabl
|
|||
#ifdef MOZ_WIDGET_GONK
|
||||
void
|
||||
ShadowLayerForwarder::UseOverlaySource(CompositableClient* aCompositable,
|
||||
const OverlaySource& aOverlay)
|
||||
const OverlaySource& aOverlay,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(), aOverlay));
|
||||
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(),
|
||||
aOverlay, aPictureRect));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -228,23 +228,19 @@ public:
|
|||
const ThebesBufferData& aThebesBufferData,
|
||||
const nsIntRegion& aUpdatedRegion) override;
|
||||
|
||||
/**
|
||||
* Communicate the picture rect of an image to the compositor
|
||||
*/
|
||||
void UpdatePictureRect(CompositableClient* aCompositable,
|
||||
const gfx::IntRect& aRect) override;
|
||||
|
||||
/**
|
||||
* See CompositableForwarder::UseTexture
|
||||
*/
|
||||
virtual void UseTexture(CompositableClient* aCompositable,
|
||||
TextureClient* aClient) override;
|
||||
TextureClient* aClient,
|
||||
const nsIntRect* aPictureRect = nullptr) override;
|
||||
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
|
||||
TextureClient* aClientOnBlack,
|
||||
TextureClient* aClientOnWhite) override;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
virtual void UseOverlaySource(CompositableClient* aCompositable,
|
||||
const OverlaySource& aOverlay) override;
|
||||
const OverlaySource& aOverlay,
|
||||
const nsIntRect& aPictureRect) override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче