mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 0736b014d4a5 (Bug 610155) for breaking canvas reftests on android
This commit is contained in:
parent
96f6c5ff38
commit
96fc781c65
@ -56,9 +56,6 @@
|
|||||||
#include "ThebesLayerBuffer.h"
|
#include "ThebesLayerBuffer.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "ReadbackProcessor.h"
|
#include "ReadbackProcessor.h"
|
||||||
#ifdef MOZ_X11
|
|
||||||
#include "gfxXlibSurface.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
|
|
||||||
@ -1627,6 +1624,12 @@ public:
|
|||||||
mShadow = aShadow;
|
mShadow = aShadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
|
||||||
|
{
|
||||||
|
NS_RUNTIMEABORT("if this default impl is called, |aBuffer| leaks");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual PRBool SupportsSurfaceDescriptor() const { return PR_FALSE; }
|
||||||
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
|
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
|
||||||
{
|
{
|
||||||
NS_RUNTIMEABORT("if this default impl is called, |aBuffer| leaks");
|
NS_RUNTIMEABORT("if this default impl is called, |aBuffer| leaks");
|
||||||
@ -1732,6 +1735,12 @@ BasicShadowableContainerLayer::RemoveChild(Layer* aChild)
|
|||||||
BasicContainerLayer::RemoveChild(aChild);
|
BasicContainerLayer::RemoveChild(aChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
|
||||||
|
{
|
||||||
|
return SurfaceDescriptor::T__None != aSurface.type();
|
||||||
|
}
|
||||||
|
|
||||||
class BasicShadowableThebesLayer : public BasicThebesLayer,
|
class BasicShadowableThebesLayer : public BasicThebesLayer,
|
||||||
public BasicShadowableLayer
|
public BasicShadowableLayer
|
||||||
{
|
{
|
||||||
@ -1761,6 +1770,8 @@ public:
|
|||||||
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
||||||
virtual bool MustRetainContent() { return HasShadow(); }
|
virtual bool MustRetainContent() { return HasShadow(); }
|
||||||
|
|
||||||
|
virtual PRBool SupportsSurfaceDescriptor() const { return PR_TRUE; }
|
||||||
|
|
||||||
void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
|
void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
|
||||||
const nsIntRegion& aValidRegion,
|
const nsIntRegion& aValidRegion,
|
||||||
float aXResolution, float aYResolution,
|
float aXResolution, float aYResolution,
|
||||||
@ -1944,8 +1955,8 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~BasicShadowableImageLayer()
|
virtual ~BasicShadowableImageLayer()
|
||||||
{
|
{
|
||||||
if (IsSurfaceDescriptorValid(mBackBuffer)) {
|
if (mBackSurface) {
|
||||||
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
|
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackSurface);
|
||||||
}
|
}
|
||||||
MOZ_COUNT_DTOR(BasicShadowableImageLayer);
|
MOZ_COUNT_DTOR(BasicShadowableImageLayer);
|
||||||
}
|
}
|
||||||
@ -1960,14 +1971,14 @@ public:
|
|||||||
virtual Layer* AsLayer() { return this; }
|
virtual Layer* AsLayer() { return this; }
|
||||||
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
||||||
|
|
||||||
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
|
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
|
||||||
{
|
{
|
||||||
mBackBuffer = aBuffer;
|
mBackSurface = aBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Disconnect()
|
virtual void Disconnect()
|
||||||
{
|
{
|
||||||
mBackBuffer = SurfaceDescriptor();
|
mBackSurface = nsnull;
|
||||||
BasicShadowableLayer::Disconnect();
|
BasicShadowableLayer::Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1977,7 +1988,7 @@ private:
|
|||||||
return static_cast<BasicShadowLayerManager*>(mManager);
|
return static_cast<BasicShadowLayerManager*>(mManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor mBackBuffer;
|
nsRefPtr<gfxSharedImageSurface> mBackSurface;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1989,18 +2000,20 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (oldSize != mSize) {
|
if (oldSize != mSize) {
|
||||||
if (IsSurfaceDescriptorValid(mBackBuffer)) {
|
if (mBackSurface) {
|
||||||
|
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackSurface);
|
||||||
|
mBackSurface = nsnull;
|
||||||
|
|
||||||
BasicManager()->DestroyedImageBuffer(BasicManager()->Hold(this));
|
BasicManager()->DestroyedImageBuffer(BasicManager()->Hold(this));
|
||||||
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor tmpFrontSurface;
|
nsRefPtr<gfxSharedImageSurface> tmpFrontSurface;
|
||||||
// XXX error handling?
|
// XXX error handling?
|
||||||
if (!BasicManager()->AllocDoubleBuffer(
|
if (!BasicManager()->AllocDoubleBuffer(
|
||||||
mSize,
|
mSize,
|
||||||
(GetContentFlags() & CONTENT_OPAQUE) ?
|
(GetContentFlags() & CONTENT_OPAQUE) ?
|
||||||
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
|
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
|
||||||
&tmpFrontSurface, &mBackBuffer))
|
getter_AddRefs(tmpFrontSurface), getter_AddRefs(mBackSurface)))
|
||||||
NS_RUNTIMEABORT("creating ImageLayer 'front buffer' failed!");
|
NS_RUNTIMEABORT("creating ImageLayer 'front buffer' failed!");
|
||||||
|
|
||||||
BasicManager()->CreatedImageBuffer(BasicManager()->Hold(this),
|
BasicManager()->CreatedImageBuffer(BasicManager()->Hold(this),
|
||||||
@ -2008,15 +2021,13 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext)
|
|||||||
tmpFrontSurface);
|
tmpFrontSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> backSurface =
|
nsRefPtr<gfxContext> tmpCtx = new gfxContext(mBackSurface);
|
||||||
BasicManager()->OpenDescriptor(mBackBuffer);
|
|
||||||
nsRefPtr<gfxContext> tmpCtx = new gfxContext(backSurface);
|
|
||||||
PaintContext(pat,
|
PaintContext(pat,
|
||||||
nsIntRegion(nsIntRect(0, 0, mSize.width, mSize.height)),
|
nsIntRegion(nsIntRect(0, 0, mSize.width, mSize.height)),
|
||||||
nsnull, 1.0, tmpCtx);
|
nsnull, 1.0, tmpCtx);
|
||||||
|
|
||||||
BasicManager()->PaintedImage(BasicManager()->Hold(this),
|
BasicManager()->PaintedImage(BasicManager()->Hold(this),
|
||||||
mBackBuffer);
|
mBackSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2059,8 +2070,8 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~BasicShadowableCanvasLayer()
|
virtual ~BasicShadowableCanvasLayer()
|
||||||
{
|
{
|
||||||
if (IsSurfaceDescriptorValid(mBackBuffer)) {
|
if (mBackBuffer) {
|
||||||
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
|
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackBuffer);
|
||||||
}
|
}
|
||||||
MOZ_COUNT_DTOR(BasicShadowableCanvasLayer);
|
MOZ_COUNT_DTOR(BasicShadowableCanvasLayer);
|
||||||
}
|
}
|
||||||
@ -2076,14 +2087,14 @@ public:
|
|||||||
virtual Layer* AsLayer() { return this; }
|
virtual Layer* AsLayer() { return this; }
|
||||||
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
||||||
|
|
||||||
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
|
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
|
||||||
{
|
{
|
||||||
mBackBuffer = aBuffer;
|
mBackBuffer = aBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Disconnect()
|
virtual void Disconnect()
|
||||||
{
|
{
|
||||||
mBackBuffer = SurfaceDescriptor();
|
mBackBuffer = nsnull;
|
||||||
BasicShadowableLayer::Disconnect();
|
BasicShadowableLayer::Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2093,7 +2104,7 @@ private:
|
|||||||
return static_cast<BasicShadowLayerManager*>(mManager);
|
return static_cast<BasicShadowLayerManager*>(mManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor mBackBuffer;
|
nsRefPtr<gfxSharedImageSurface> mBackBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2105,20 +2116,20 @@ BasicShadowableCanvasLayer::Initialize(const Data& aData)
|
|||||||
|
|
||||||
// XXX won't get here currently; need to figure out what to do on
|
// XXX won't get here currently; need to figure out what to do on
|
||||||
// canvas resizes
|
// canvas resizes
|
||||||
|
if (mBackBuffer) {
|
||||||
if (IsSurfaceDescriptorValid(mBackBuffer)) {
|
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackBuffer);
|
||||||
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
|
mBackBuffer = nsnull;
|
||||||
|
|
||||||
BasicManager()->DestroyedCanvasBuffer(BasicManager()->Hold(this));
|
BasicManager()->DestroyedCanvasBuffer(BasicManager()->Hold(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor tmpFrontBuffer;
|
nsRefPtr<gfxSharedImageSurface> tmpFrontBuffer;
|
||||||
// XXX error handling?
|
// XXX error handling?
|
||||||
if (!BasicManager()->AllocDoubleBuffer(
|
if (!BasicManager()->AllocDoubleBuffer(
|
||||||
gfxIntSize(aData.mSize.width, aData.mSize.height),
|
gfxIntSize(aData.mSize.width, aData.mSize.height),
|
||||||
(GetContentFlags() & CONTENT_OPAQUE) ?
|
(GetContentFlags() & CONTENT_OPAQUE) ?
|
||||||
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
|
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
|
||||||
&tmpFrontBuffer, &mBackBuffer))
|
getter_AddRefs(tmpFrontBuffer), getter_AddRefs(mBackBuffer)))
|
||||||
NS_RUNTIMEABORT("creating CanvasLayer back buffer failed!");
|
NS_RUNTIMEABORT("creating CanvasLayer back buffer failed!");
|
||||||
|
|
||||||
BasicManager()->CreatedCanvasBuffer(BasicManager()->Hold(this),
|
BasicManager()->CreatedCanvasBuffer(BasicManager()->Hold(this),
|
||||||
@ -2138,9 +2149,7 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext)
|
|||||||
// changed areas, much like we do for Thebes layers, as well as
|
// changed areas, much like we do for Thebes layers, as well as
|
||||||
// do all sorts of magic to swap out the surface underneath the
|
// do all sorts of magic to swap out the surface underneath the
|
||||||
// canvas' thebes/cairo context.
|
// canvas' thebes/cairo context.
|
||||||
nsRefPtr<gfxASurface> backSurface =
|
nsRefPtr<gfxContext> tmpCtx = new gfxContext(mBackBuffer);
|
||||||
BasicManager()->OpenDescriptor(mBackBuffer);
|
|
||||||
nsRefPtr<gfxContext> tmpCtx = new gfxContext(backSurface);
|
|
||||||
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||||
|
|
||||||
// call BasicCanvasLayer::Paint to draw to our tmp context, because
|
// call BasicCanvasLayer::Paint to draw to our tmp context, because
|
||||||
@ -2433,15 +2442,17 @@ public:
|
|||||||
ShadowImageLayer::Disconnect();
|
ShadowImageLayer::Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& size);
|
virtual PRBool Init(gfxSharedImageSurface* front, const nsIntSize& size);
|
||||||
|
|
||||||
virtual void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack);
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
|
Swap(gfxSharedImageSurface* newFront);
|
||||||
|
|
||||||
virtual void DestroyFrontBuffer()
|
virtual void DestroyFrontBuffer()
|
||||||
{
|
{
|
||||||
if (IsSurfaceDescriptorValid(mFrontBuffer)) {
|
if (mFrontSurface) {
|
||||||
BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontBuffer, mAllocator);
|
BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
|
||||||
}
|
}
|
||||||
|
mFrontSurface = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Paint(gfxContext* aContext);
|
virtual void Paint(gfxContext* aContext);
|
||||||
@ -2452,36 +2463,36 @@ protected:
|
|||||||
return static_cast<BasicShadowLayerManager*>(mManager);
|
return static_cast<BasicShadowLayerManager*>(mManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor mFrontBuffer;
|
// XXX ShmemImage?
|
||||||
|
nsRefPtr<gfxSharedImageSurface> mFrontSurface;
|
||||||
gfxIntSize mSize;
|
gfxIntSize mSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
BasicShadowImageLayer::Init(const SurfaceDescriptor& front,
|
BasicShadowImageLayer::Init(gfxSharedImageSurface* front,
|
||||||
const nsIntSize& size)
|
const nsIntSize& size)
|
||||||
{
|
{
|
||||||
mFrontBuffer = front;
|
mFrontSurface = front;
|
||||||
mSize = gfxIntSize(size.width, size.height);
|
mSize = gfxIntSize(size.width, size.height);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
already_AddRefed<gfxSharedImageSurface>
|
||||||
BasicShadowImageLayer::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
|
BasicShadowImageLayer::Swap(gfxSharedImageSurface* newFront)
|
||||||
{
|
{
|
||||||
*aNewBack = mFrontBuffer;
|
already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
|
||||||
mFrontBuffer = aNewFront;
|
mFrontSurface = newFront;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicShadowImageLayer::Paint(gfxContext* aContext)
|
BasicShadowImageLayer::Paint(gfxContext* aContext)
|
||||||
{
|
{
|
||||||
if (!IsSurfaceDescriptorValid(mFrontBuffer)) {
|
if (!mFrontSurface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surface =
|
nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
|
||||||
BasicManager()->OpenDescriptor(mFrontBuffer);
|
|
||||||
nsRefPtr<gfxPattern> pat = new gfxPattern(surface);
|
|
||||||
pat->SetFilter(mFilter);
|
pat->SetFilter(mFilter);
|
||||||
|
|
||||||
// The visible region can extend outside the image. If we're not
|
// The visible region can extend outside the image. If we're not
|
||||||
@ -2535,15 +2546,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void Initialize(const Data& aData);
|
virtual void Initialize(const Data& aData);
|
||||||
virtual void Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize);
|
|
||||||
|
|
||||||
void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack);
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
|
Swap(gfxSharedImageSurface* newFront);
|
||||||
|
|
||||||
virtual void DestroyFrontBuffer()
|
virtual void DestroyFrontBuffer()
|
||||||
{
|
{
|
||||||
if (IsSurfaceDescriptorValid(mFrontSurface)) {
|
if (mFrontSurface) {
|
||||||
BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontSurface, mAllocator);
|
BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
|
||||||
}
|
}
|
||||||
|
mFrontSurface = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Paint(gfxContext* aContext);
|
virtual void Paint(gfxContext* aContext);
|
||||||
@ -2554,28 +2566,27 @@ private:
|
|||||||
return static_cast<BasicShadowLayerManager*>(mManager);
|
return static_cast<BasicShadowLayerManager*>(mManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceDescriptor mFrontSurface;
|
nsRefPtr<gfxSharedImageSurface> mFrontSurface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicShadowCanvasLayer::Initialize(const Data& aData)
|
BasicShadowCanvasLayer::Initialize(const Data& aData)
|
||||||
{
|
{
|
||||||
NS_RUNTIMEABORT("Incompatibe surface type");
|
NS_ASSERTION(mFrontSurface == nsnull,
|
||||||
|
"BasicCanvasLayer::Initialize called twice!");
|
||||||
|
NS_ASSERTION(aData.mSurface && !aData.mGLContext, "no comprende OpenGL!");
|
||||||
|
|
||||||
|
mFrontSurface = static_cast<gfxSharedImageSurface*>(aData.mSurface);
|
||||||
|
mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
already_AddRefed<gfxSharedImageSurface>
|
||||||
BasicShadowCanvasLayer::Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize)
|
BasicShadowCanvasLayer::Swap(gfxSharedImageSurface* newFront)
|
||||||
{
|
{
|
||||||
mFrontSurface = aNewFront;
|
already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
|
||||||
mBounds.SetRect(0, 0, aSize.width, aSize.height);
|
mFrontSurface = newFront;
|
||||||
}
|
return tmp;
|
||||||
|
|
||||||
void
|
|
||||||
BasicShadowCanvasLayer::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
|
|
||||||
{
|
|
||||||
*aNewBack = mFrontSurface;
|
|
||||||
mFrontSurface = aNewFront;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2584,13 +2595,11 @@ BasicShadowCanvasLayer::Paint(gfxContext* aContext)
|
|||||||
NS_ASSERTION(BasicManager()->InDrawing(),
|
NS_ASSERTION(BasicManager()->InDrawing(),
|
||||||
"Can only draw in drawing phase");
|
"Can only draw in drawing phase");
|
||||||
|
|
||||||
if (IsSurfaceDescriptorValid(mFrontSurface)) {
|
if (!mFrontSurface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surface =
|
nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
|
||||||
BasicManager()->OpenDescriptor(mFrontSurface);
|
|
||||||
nsRefPtr<gfxPattern> pat = new gfxPattern(surface);
|
|
||||||
|
|
||||||
pat->SetFilter(mFilter);
|
pat->SetFilter(mFilter);
|
||||||
pat->SetExtend(gfxPattern::EXTEND_PAD);
|
pat->SetExtend(gfxPattern::EXTEND_PAD);
|
||||||
@ -2821,7 +2830,17 @@ BasicShadowLayerManager::ForwardTransaction()
|
|||||||
|
|
||||||
const OpBufferSwap& obs = reply.get_OpBufferSwap();
|
const OpBufferSwap& obs = reply.get_OpBufferSwap();
|
||||||
const SurfaceDescriptor& descr = obs.newBackBuffer();
|
const SurfaceDescriptor& descr = obs.newBackBuffer();
|
||||||
GetBasicShadowable(obs)->SetBackBuffer(descr);
|
BasicShadowableLayer* layer = GetBasicShadowable(obs);
|
||||||
|
if (layer->SupportsSurfaceDescriptor()) {
|
||||||
|
layer->SetBackBuffer(descr);
|
||||||
|
} else {
|
||||||
|
if (SurfaceDescriptor::TShmem != descr.type()) {
|
||||||
|
NS_RUNTIMEABORT("non-Shmem surface sent to a layer that expected one!");
|
||||||
|
}
|
||||||
|
nsRefPtr<gfxASurface> imageSurf = OpenDescriptor(descr);
|
||||||
|
layer->SetBackBufferImage(
|
||||||
|
static_cast<gfxSharedImageSurface*>(imageSurf.get()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,14 +102,14 @@ struct OpDestroyThebesFrontBuffer { PLayer layer; };
|
|||||||
struct OpCreateCanvasBuffer {
|
struct OpCreateCanvasBuffer {
|
||||||
PLayer layer;
|
PLayer layer;
|
||||||
nsIntSize size;
|
nsIntSize size;
|
||||||
SurfaceDescriptor initialFront;
|
Shmem initialFront;
|
||||||
};
|
};
|
||||||
struct OpDestroyCanvasFrontBuffer { PLayer layer; };
|
struct OpDestroyCanvasFrontBuffer { PLayer layer; };
|
||||||
|
|
||||||
struct OpCreateImageBuffer {
|
struct OpCreateImageBuffer {
|
||||||
PLayer layer;
|
PLayer layer;
|
||||||
nsIntSize size;
|
nsIntSize size;
|
||||||
SurfaceDescriptor initialFront;
|
Shmem initialFront;
|
||||||
};
|
};
|
||||||
struct OpDestroyImageFrontBuffer { PLayer layer; };
|
struct OpDestroyImageFrontBuffer { PLayer layer; };
|
||||||
|
|
||||||
@ -173,12 +173,12 @@ struct OpPaintThebesBuffer {
|
|||||||
|
|
||||||
struct OpPaintCanvas {
|
struct OpPaintCanvas {
|
||||||
PLayer layer;
|
PLayer layer;
|
||||||
SurfaceDescriptor newFrontBuffer;
|
Shmem newFrontBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OpPaintImage {
|
struct OpPaintImage {
|
||||||
PLayer layer;
|
PLayer layer;
|
||||||
SurfaceDescriptor newFrontBuffer;
|
Shmem newFrontBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
|
|||||||
const SurfaceDescriptor& aTempFrontBuffer)
|
const SurfaceDescriptor& aTempFrontBuffer)
|
||||||
{
|
{
|
||||||
OptionalThebesBuffer buffer = null_t();
|
OptionalThebesBuffer buffer = null_t();
|
||||||
if (IsSurfaceDescriptorValid(aTempFrontBuffer)) {
|
if (SurfaceDescriptor::T__None != aTempFrontBuffer.type()) {
|
||||||
buffer = ThebesBuffer(aTempFrontBuffer,
|
buffer = ThebesBuffer(aTempFrontBuffer,
|
||||||
aBufferRect,
|
aBufferRect,
|
||||||
nsIntPoint(0, 0));
|
nsIntPoint(0, 0));
|
||||||
@ -207,21 +207,21 @@ ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
|
|||||||
void
|
void
|
||||||
ShadowLayerForwarder::CreatedImageBuffer(ShadowableLayer* aImage,
|
ShadowLayerForwarder::CreatedImageBuffer(ShadowableLayer* aImage,
|
||||||
nsIntSize aSize,
|
nsIntSize aSize,
|
||||||
const SurfaceDescriptor& aTempFrontSurface)
|
gfxSharedImageSurface* aTempFrontSurface)
|
||||||
{
|
{
|
||||||
mTxn->AddEdit(OpCreateImageBuffer(NULL, Shadow(aImage),
|
mTxn->AddEdit(OpCreateImageBuffer(NULL, Shadow(aImage),
|
||||||
aSize,
|
aSize,
|
||||||
aTempFrontSurface));
|
aTempFrontSurface->GetShmem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShadowLayerForwarder::CreatedCanvasBuffer(ShadowableLayer* aCanvas,
|
ShadowLayerForwarder::CreatedCanvasBuffer(ShadowableLayer* aCanvas,
|
||||||
nsIntSize aSize,
|
nsIntSize aSize,
|
||||||
const SurfaceDescriptor& aTempFrontSurface)
|
gfxSharedImageSurface* aTempFrontSurface)
|
||||||
{
|
{
|
||||||
mTxn->AddEdit(OpCreateCanvasBuffer(NULL, Shadow(aCanvas),
|
mTxn->AddEdit(OpCreateCanvasBuffer(NULL, Shadow(aCanvas),
|
||||||
aSize,
|
aSize,
|
||||||
aTempFrontSurface));
|
aTempFrontSurface->GetShmem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -291,17 +291,17 @@ ShadowLayerForwarder::PaintedThebesBuffer(ShadowableLayer* aThebes,
|
|||||||
}
|
}
|
||||||
void
|
void
|
||||||
ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage,
|
ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage,
|
||||||
const SurfaceDescriptor& aNewFrontSurface)
|
gfxSharedImageSurface* aNewFrontSurface)
|
||||||
{
|
{
|
||||||
mTxn->AddPaint(OpPaintImage(NULL, Shadow(aImage),
|
mTxn->AddPaint(OpPaintImage(NULL, Shadow(aImage),
|
||||||
aNewFrontSurface));
|
aNewFrontSurface->GetShmem()));
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas,
|
ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas,
|
||||||
const SurfaceDescriptor& aNewFrontSurface)
|
gfxSharedImageSurface* aNewFrontSurface)
|
||||||
{
|
{
|
||||||
mTxn->AddPaint(OpPaintCanvas(NULL, Shadow(aCanvas),
|
mTxn->AddPaint(OpPaintCanvas(NULL, Shadow(aCanvas),
|
||||||
aNewFrontSurface));
|
aNewFrontSurface->GetShmem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
@ -636,11 +636,5 @@ ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
|
|||||||
|
|
||||||
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
||||||
|
|
||||||
PRBool
|
|
||||||
IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
|
|
||||||
{
|
|
||||||
return SurfaceDescriptor::T__None != aSurface.type();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -165,10 +165,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void CreatedImageBuffer(ShadowableLayer* aImage,
|
void CreatedImageBuffer(ShadowableLayer* aImage,
|
||||||
nsIntSize aSize,
|
nsIntSize aSize,
|
||||||
const SurfaceDescriptor& aInitialFrontSurface);
|
gfxSharedImageSurface* aInitialFrontSurface);
|
||||||
void CreatedCanvasBuffer(ShadowableLayer* aCanvas,
|
void CreatedCanvasBuffer(ShadowableLayer* aCanvas,
|
||||||
nsIntSize aSize,
|
nsIntSize aSize,
|
||||||
const SurfaceDescriptor& aInitialFrontSurface);
|
gfxSharedImageSurface* aInitialFrontSurface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The specified layer is destroying its buffers.
|
* The specified layer is destroying its buffers.
|
||||||
@ -225,9 +225,9 @@ public:
|
|||||||
* ImageLayers. This is slow, and will be optimized.
|
* ImageLayers. This is slow, and will be optimized.
|
||||||
*/
|
*/
|
||||||
void PaintedImage(ShadowableLayer* aImage,
|
void PaintedImage(ShadowableLayer* aImage,
|
||||||
const SurfaceDescriptor& aNewFrontSurface);
|
gfxSharedImageSurface* aNewFrontSurface);
|
||||||
void PaintedCanvas(ShadowableLayer* aCanvas,
|
void PaintedCanvas(ShadowableLayer* aCanvas,
|
||||||
const SurfaceDescriptor& aNewFrontSurface);
|
gfxSharedImageSurface* aNewFrontSurface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End the current transaction and forward it to ShadowLayerManager.
|
* End the current transaction and forward it to ShadowLayerManager.
|
||||||
@ -569,17 +569,6 @@ class ShadowCanvasLayer : public ShadowLayer,
|
|||||||
public CanvasLayer
|
public CanvasLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
|
||||||
* CONSTRUCTION PHASE ONLY
|
|
||||||
*
|
|
||||||
* Initialize this with a (temporary) front surface with the given
|
|
||||||
* size. This is expected to be followed with a Swap() in the same
|
|
||||||
* transaction to bring in real pixels. Init() may only be called
|
|
||||||
* once.
|
|
||||||
*/
|
|
||||||
virtual void Init(const SurfaceDescriptor& front, const nsIntSize& aSize) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONSTRUCTION PHASE ONLY
|
* CONSTRUCTION PHASE ONLY
|
||||||
*
|
*
|
||||||
@ -587,7 +576,8 @@ public:
|
|||||||
* out the old front surface (the new back surface for the remote
|
* out the old front surface (the new back surface for the remote
|
||||||
* layer).
|
* layer).
|
||||||
*/
|
*/
|
||||||
virtual void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack) = 0;
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
|
Swap(gfxSharedImageSurface* aNewFront) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONSTRUCTION PHASE ONLY
|
* CONSTRUCTION PHASE ONLY
|
||||||
@ -619,13 +609,14 @@ public:
|
|||||||
* transaction to bring in real pixels. Init() may only be called
|
* transaction to bring in real pixels. Init() may only be called
|
||||||
* once.
|
* once.
|
||||||
*/
|
*/
|
||||||
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& aSize) = 0;
|
virtual PRBool Init(gfxSharedImageSurface* aFront, const nsIntSize& aSize) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONSTRUCTION PHASE ONLY
|
* CONSTRUCTION PHASE ONLY
|
||||||
* @see ShadowCanvasLayer::Swap
|
* @see ShadowCanvasLayer::Swap
|
||||||
*/
|
*/
|
||||||
virtual void Swap(const SurfaceDescriptor& aFront, SurfaceDescriptor* aNewBack) = 0;
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
|
Swap(gfxSharedImageSurface* newFront) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONSTRUCTION PHASE ONLY
|
* CONSTRUCTION PHASE ONLY
|
||||||
@ -659,7 +650,6 @@ protected:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
PRBool IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface);
|
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -222,8 +222,13 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||||||
const OpCreateCanvasBuffer& ocb = edit.get_OpCreateCanvasBuffer();
|
const OpCreateCanvasBuffer& ocb = edit.get_OpCreateCanvasBuffer();
|
||||||
ShadowCanvasLayer* canvas = static_cast<ShadowCanvasLayer*>(
|
ShadowCanvasLayer* canvas = static_cast<ShadowCanvasLayer*>(
|
||||||
AsShadowLayer(ocb)->AsLayer());
|
AsShadowLayer(ocb)->AsLayer());
|
||||||
|
nsRefPtr<gfxSharedImageSurface> front =
|
||||||
|
gfxSharedImageSurface::Open(ocb.initialFront());
|
||||||
|
CanvasLayer::Data data;
|
||||||
|
data.mSurface = front;
|
||||||
|
data.mSize = ocb.size();
|
||||||
|
|
||||||
canvas->Init(ocb.initialFront(), ocb.size());
|
canvas->Initialize(data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -234,7 +239,9 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||||||
ShadowImageLayer* image = static_cast<ShadowImageLayer*>(
|
ShadowImageLayer* image = static_cast<ShadowImageLayer*>(
|
||||||
AsShadowLayer(ocb)->AsLayer());
|
AsShadowLayer(ocb)->AsLayer());
|
||||||
|
|
||||||
image->Init(ocb.initialFront(), ocb.size());
|
nsRefPtr<gfxSharedImageSurface> surf =
|
||||||
|
gfxSharedImageSurface::Open(ocb.initialFront());
|
||||||
|
image->Init(surf, ocb.size());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -409,17 +416,17 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||||||
ShadowCanvasLayer* canvas =
|
ShadowCanvasLayer* canvas =
|
||||||
static_cast<ShadowCanvasLayer*>(shadow->AsLayer());
|
static_cast<ShadowCanvasLayer*>(shadow->AsLayer());
|
||||||
|
|
||||||
SurfaceDescriptor newFront = op.newFrontBuffer();
|
nsRefPtr<gfxSharedImageSurface> newFront =
|
||||||
SurfaceDescriptor newBack;
|
gfxSharedImageSurface::Open(op.newFrontBuffer());
|
||||||
canvas->Swap(op.newFrontBuffer(), &newBack);
|
nsRefPtr<gfxSharedImageSurface> newBack = canvas->Swap(newFront);
|
||||||
if (newFront == newBack) {
|
if (newFront == newBack) {
|
||||||
newFront = SurfaceDescriptor();
|
newFront.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas->Updated();
|
canvas->Updated();
|
||||||
|
|
||||||
replyv.push_back(OpBufferSwap(shadow, NULL,
|
replyv.push_back(OpBufferSwap(shadow, NULL,
|
||||||
newBack));
|
newBack->GetShmem()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -431,15 +438,15 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||||||
ShadowImageLayer* image =
|
ShadowImageLayer* image =
|
||||||
static_cast<ShadowImageLayer*>(shadow->AsLayer());
|
static_cast<ShadowImageLayer*>(shadow->AsLayer());
|
||||||
|
|
||||||
SurfaceDescriptor newFront = op.newFrontBuffer();
|
nsRefPtr<gfxSharedImageSurface> newFront =
|
||||||
SurfaceDescriptor newBack;
|
gfxSharedImageSurface::Open(op.newFrontBuffer());
|
||||||
image->Swap(op.newFrontBuffer(), &newBack);
|
nsRefPtr<gfxSharedImageSurface> newBack = image->Swap(newFront);
|
||||||
if (newFront == newBack) {
|
if (newFront == newBack) {
|
||||||
newFront = SurfaceDescriptor();
|
newFront.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
replyv.push_back(OpBufferSwap(shadow, NULL,
|
replyv.push_back(OpBufferSwap(shadow, NULL,
|
||||||
newBack));
|
newBack->GetShmem()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,6 @@
|
|||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
|
||||||
#include "gfxXlibSurface.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
using namespace mozilla::gl;
|
using namespace mozilla::gl;
|
||||||
@ -297,40 +293,34 @@ ShadowCanvasLayerOGL::~ShadowCanvasLayerOGL()
|
|||||||
void
|
void
|
||||||
ShadowCanvasLayerOGL::Initialize(const Data& aData)
|
ShadowCanvasLayerOGL::Initialize(const Data& aData)
|
||||||
{
|
{
|
||||||
NS_RUNTIMEABORT("Incompatibe surface type");
|
mDeadweight = static_cast<gfxSharedImageSurface*>(aData.mSurface);
|
||||||
}
|
gfxSize sz = mDeadweight->GetSize();
|
||||||
|
mTexImage = gl()->CreateTextureImage(nsIntSize(sz.width, sz.height),
|
||||||
void
|
mDeadweight->GetContentType(),
|
||||||
ShadowCanvasLayerOGL::Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize)
|
|
||||||
{
|
|
||||||
mDeadweight = aNewFront;
|
|
||||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(mDeadweight);
|
|
||||||
|
|
||||||
mTexImage = gl()->CreateTextureImage(nsIntSize(aSize.width, aSize.height),
|
|
||||||
surf->GetContentType(),
|
|
||||||
LOCAL_GL_CLAMP_TO_EDGE);
|
LOCAL_GL_CLAMP_TO_EDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
already_AddRefed<gfxSharedImageSurface>
|
||||||
ShadowCanvasLayerOGL::Swap(const SurfaceDescriptor& aNewFront,
|
ShadowCanvasLayerOGL::Swap(gfxSharedImageSurface* aNewFront)
|
||||||
SurfaceDescriptor* aNewBack)
|
|
||||||
{
|
{
|
||||||
if (!mDestroyed && mTexImage) {
|
if (!mDestroyed && mTexImage) {
|
||||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront);
|
// XXX this is always just ridiculously slow
|
||||||
gfxSize sz = surf->GetSize();
|
|
||||||
|
gfxSize sz = aNewFront->GetSize();
|
||||||
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
||||||
mTexImage->DirectUpdate(surf, updateRegion);
|
mTexImage->DirectUpdate(aNewFront, updateRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aNewBack = aNewFront;
|
return aNewFront;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShadowCanvasLayerOGL::DestroyFrontBuffer()
|
ShadowCanvasLayerOGL::DestroyFrontBuffer()
|
||||||
{
|
{
|
||||||
mTexImage = nsnull;
|
mTexImage = nsnull;
|
||||||
if (IsSurfaceDescriptorValid(mDeadweight)) {
|
if (mDeadweight) {
|
||||||
mOGLManager->DestroySharedSurface(&mDeadweight, mAllocator);
|
mOGLManager->DestroySharedSurface(mDeadweight, mAllocator);
|
||||||
|
mDeadweight = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,14 +110,12 @@ public:
|
|||||||
|
|
||||||
// CanvasLayer impl
|
// CanvasLayer impl
|
||||||
virtual void Initialize(const Data& aData);
|
virtual void Initialize(const Data& aData);
|
||||||
virtual void Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize);
|
|
||||||
|
|
||||||
// This isn't meaningful for shadow canvas.
|
// This isn't meaningful for shadow canvas.
|
||||||
virtual void Updated(const nsIntRect&) {}
|
virtual void Updated(const nsIntRect&) {}
|
||||||
|
|
||||||
// ShadowCanvasLayer impl
|
// ShadowCanvasLayer impl
|
||||||
virtual void Swap(const SurfaceDescriptor& aNewFront,
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
SurfaceDescriptor* aNewBack);
|
Swap(gfxSharedImageSurface* aNewFront);
|
||||||
|
|
||||||
virtual void DestroyFrontBuffer();
|
virtual void DestroyFrontBuffer();
|
||||||
|
|
||||||
@ -132,7 +130,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
nsRefPtr<TextureImage> mTexImage;
|
nsRefPtr<TextureImage> mTexImage;
|
||||||
|
|
||||||
SurfaceDescriptor mDeadweight;
|
|
||||||
|
// XXX FIXME holding to free
|
||||||
|
nsRefPtr<gfxSharedImageSurface> mDeadweight;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* layers */
|
} /* layers */
|
||||||
|
@ -790,38 +790,38 @@ ShadowImageLayerOGL::~ShadowImageLayerOGL()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
ShadowImageLayerOGL::Init(const SurfaceDescriptor& aFront,
|
ShadowImageLayerOGL::Init(gfxSharedImageSurface* aFront,
|
||||||
const nsIntSize& aSize)
|
const nsIntSize& aSize)
|
||||||
{
|
{
|
||||||
mDeadweight = aFront;
|
mDeadweight = aFront;
|
||||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aFront);
|
gfxSize sz = mDeadweight->GetSize();
|
||||||
gfxSize sz = surf->GetSize();
|
|
||||||
mTexImage = gl()->CreateTextureImage(nsIntSize(sz.width, sz.height),
|
mTexImage = gl()->CreateTextureImage(nsIntSize(sz.width, sz.height),
|
||||||
surf->GetContentType(),
|
mDeadweight->GetContentType(),
|
||||||
LOCAL_GL_CLAMP_TO_EDGE);
|
LOCAL_GL_CLAMP_TO_EDGE);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
already_AddRefed<gfxSharedImageSurface>
|
||||||
ShadowImageLayerOGL::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
|
ShadowImageLayerOGL::Swap(gfxSharedImageSurface* aNewFront)
|
||||||
{
|
{
|
||||||
if (!mDestroyed && mTexImage) {
|
if (!mDestroyed && mTexImage) {
|
||||||
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront);
|
|
||||||
// XXX this is always just ridiculously slow
|
// XXX this is always just ridiculously slow
|
||||||
gfxSize sz = surf->GetSize();
|
|
||||||
|
gfxSize sz = aNewFront->GetSize();
|
||||||
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
||||||
mTexImage->DirectUpdate(surf, updateRegion);
|
mTexImage->DirectUpdate(aNewFront, updateRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aNewBack = aNewFront;
|
return aNewFront;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShadowImageLayerOGL::DestroyFrontBuffer()
|
ShadowImageLayerOGL::DestroyFrontBuffer()
|
||||||
{
|
{
|
||||||
mTexImage = nsnull;
|
mTexImage = nsnull;
|
||||||
if (IsSurfaceDescriptorValid(mDeadweight)) {
|
if (mDeadweight) {
|
||||||
mOGLManager->DestroySharedSurface(&mDeadweight, mAllocator);
|
mOGLManager->DestroySharedSurface(mDeadweight, mAllocator);
|
||||||
|
mDeadweight = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,9 +245,10 @@ public:
|
|||||||
virtual ~ShadowImageLayerOGL();
|
virtual ~ShadowImageLayerOGL();
|
||||||
|
|
||||||
// ShadowImageLayer impl
|
// ShadowImageLayer impl
|
||||||
virtual PRBool Init(const SurfaceDescriptor& aFront, const nsIntSize& aSize);
|
virtual PRBool Init(gfxSharedImageSurface* aFront, const nsIntSize& aSize);
|
||||||
|
|
||||||
virtual void Swap(const SurfaceDescriptor& aFront, SurfaceDescriptor* aNewBack);
|
virtual already_AddRefed<gfxSharedImageSurface>
|
||||||
|
Swap(gfxSharedImageSurface* aNewFront);
|
||||||
|
|
||||||
virtual void DestroyFrontBuffer();
|
virtual void DestroyFrontBuffer();
|
||||||
|
|
||||||
@ -264,7 +265,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
nsRefPtr<TextureImage> mTexImage;
|
nsRefPtr<TextureImage> mTexImage;
|
||||||
|
|
||||||
SurfaceDescriptor mDeadweight;
|
|
||||||
|
// XXX FIXME holding to free
|
||||||
|
nsRefPtr<gfxSharedImageSurface> mDeadweight;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* layers */
|
} /* layers */
|
||||||
|
Loading…
Reference in New Issue
Block a user