зеркало из https://github.com/mozilla/gecko-dev.git
Bug 649417 - Part 1 - Create a SharedImage ipdl union and pass this to ShadowImageLayer::Swap . r=cjones
This commit is contained in:
Родитель
7aefc7645a
Коммит
2748614ad5
|
@ -2433,9 +2433,9 @@ public:
|
|||
ShadowImageLayer::Disconnect();
|
||||
}
|
||||
|
||||
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& size);
|
||||
virtual PRBool Init(const SharedImage& front, const nsIntSize& size);
|
||||
|
||||
virtual void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack);
|
||||
virtual void Swap(const SharedImage& aNewFront, SharedImage* aNewBack);
|
||||
|
||||
virtual void DestroyFrontBuffer()
|
||||
{
|
||||
|
@ -2457,19 +2457,19 @@ protected:
|
|||
};
|
||||
|
||||
PRBool
|
||||
BasicShadowImageLayer::Init(const SurfaceDescriptor& front,
|
||||
BasicShadowImageLayer::Init(const SharedImage& front,
|
||||
const nsIntSize& size)
|
||||
{
|
||||
mFrontBuffer = front;
|
||||
mFrontBuffer = front.get_SurfaceDescriptor();
|
||||
mSize = gfxIntSize(size.width, size.height);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
BasicShadowImageLayer::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
|
||||
BasicShadowImageLayer::Swap(const SharedImage& aNewFront, SharedImage* aNewBack)
|
||||
{
|
||||
*aNewBack = mFrontBuffer;
|
||||
mFrontBuffer = aNewFront;
|
||||
mFrontBuffer = aNewFront.get_SurfaceDescriptor();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -83,6 +83,10 @@ union SurfaceDescriptor {
|
|||
SurfaceDescriptorX11;
|
||||
};
|
||||
|
||||
union SharedImage {
|
||||
SurfaceDescriptor;
|
||||
};
|
||||
|
||||
struct ThebesBuffer {
|
||||
SurfaceDescriptor buffer;
|
||||
nsIntRect rect;
|
||||
|
@ -109,7 +113,7 @@ struct OpDestroyCanvasFrontBuffer { PLayer layer; };
|
|||
struct OpCreateImageBuffer {
|
||||
PLayer layer;
|
||||
nsIntSize size;
|
||||
SurfaceDescriptor initialFront;
|
||||
SharedImage initialFront;
|
||||
};
|
||||
struct OpDestroyImageFrontBuffer { PLayer layer; };
|
||||
|
||||
|
@ -178,7 +182,7 @@ struct OpPaintCanvas {
|
|||
|
||||
struct OpPaintImage {
|
||||
PLayer layer;
|
||||
SurfaceDescriptor newFrontBuffer;
|
||||
SharedImage newFrontBuffer;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ class ShadowCanvasLayer;
|
|||
class SurfaceDescriptor;
|
||||
class ThebesBuffer;
|
||||
class Transaction;
|
||||
class SharedImage;
|
||||
|
||||
/**
|
||||
* We want to share layer trees across thread contexts and address
|
||||
|
@ -619,13 +620,13 @@ public:
|
|||
* transaction to bring in real pixels. Init() may only be called
|
||||
* once.
|
||||
*/
|
||||
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& aSize) = 0;
|
||||
virtual PRBool Init(const SharedImage& front, const nsIntSize& aSize) = 0;
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* @see ShadowCanvasLayer::Swap
|
||||
*/
|
||||
virtual void Swap(const SurfaceDescriptor& aFront, SurfaceDescriptor* aNewBack) = 0;
|
||||
virtual void Swap(const SharedImage& aFront, SharedImage* aNewBack) = 0;
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
|
|
|
@ -432,9 +432,9 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||
static_cast<ShadowImageLayer*>(shadow->AsLayer());
|
||||
|
||||
SurfaceDescriptor newFront = op.newFrontBuffer();
|
||||
SurfaceDescriptor newBack;
|
||||
SharedImage newBack;
|
||||
image->Swap(op.newFrontBuffer(), &newBack);
|
||||
if (newFront == newBack) {
|
||||
if (newFront == newBack.get_SurfaceDescriptor()) {
|
||||
newFront = SurfaceDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -790,11 +790,12 @@ ShadowImageLayerOGL::~ShadowImageLayerOGL()
|
|||
{}
|
||||
|
||||
PRBool
|
||||
ShadowImageLayerOGL::Init(const SurfaceDescriptor& aFront,
|
||||
ShadowImageLayerOGL::Init(const SharedImage& aFront,
|
||||
const nsIntSize& aSize)
|
||||
{
|
||||
mDeadweight = aFront;
|
||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aFront);
|
||||
nsRefPtr<gfxASurface> surf =
|
||||
ShadowLayerForwarder::OpenDescriptor(aFront.get_SurfaceDescriptor());
|
||||
gfxSize sz = surf->GetSize();
|
||||
mTexImage = gl()->CreateTextureImage(nsIntSize(sz.width, sz.height),
|
||||
surf->GetContentType(),
|
||||
|
@ -803,10 +804,11 @@ ShadowImageLayerOGL::Init(const SurfaceDescriptor& aFront,
|
|||
}
|
||||
|
||||
void
|
||||
ShadowImageLayerOGL::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
|
||||
ShadowImageLayerOGL::Swap(const SharedImage& aNewFront, SharedImage* aNewBack)
|
||||
{
|
||||
if (!mDestroyed && mTexImage) {
|
||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront);
|
||||
nsRefPtr<gfxASurface> surf =
|
||||
ShadowLayerForwarder::OpenDescriptor(aNewFront.get_SurfaceDescriptor());
|
||||
// XXX this is always just ridiculously slow
|
||||
gfxSize sz = surf->GetSize();
|
||||
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
||||
|
|
|
@ -245,9 +245,9 @@ public:
|
|||
virtual ~ShadowImageLayerOGL();
|
||||
|
||||
// ShadowImageLayer impl
|
||||
virtual PRBool Init(const SurfaceDescriptor& aFront, const nsIntSize& aSize);
|
||||
virtual PRBool Init(const SharedImage& aFront, const nsIntSize& aSize);
|
||||
|
||||
virtual void Swap(const SurfaceDescriptor& aFront, SurfaceDescriptor* aNewBack);
|
||||
virtual void Swap(const SharedImage& aFront, SharedImage* aNewBack);
|
||||
|
||||
virtual void DestroyFrontBuffer();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче