Bug 770617 - Always mark inactive CanvasLayers as being dirty. r=cjones

This commit is contained in:
Matt Woodrow 2012-09-30 19:20:25 +13:00
parent 930cae2bd2
commit 202bc0e49e
5 changed files with 31 additions and 9 deletions

View File

@ -1389,6 +1389,26 @@ public:
*/
void Updated() { mDirty = true; SetInvalidRectToVisibleRegion(); }
/**
* Notify this CanvasLayer that the canvas surface contents have
* been painted since the last change.
*/
void Painted() { mDirty = false; }
/**
* Returns true if the canvas surface contents have changed since the
* last paint.
*/
bool IsDirty()
{
// We can only tell if we are dirty if we're part of the
// widget's retained layer tree.
if (!mManager || !mManager->IsWidgetLayerManager()) {
return true;
}
return mDirty;
}
/**
* Register a callback to be called at the end of each transaction.
*/
@ -1443,6 +1463,8 @@ protected:
DidTransactionCallback mCallback;
void* mCallbackData;
gfxPattern::GraphicsFilter mFilter;
private:
/**
* Set to true in Updated(), cleared during a transaction.
*/

View File

@ -120,9 +120,9 @@ BasicCanvasLayer::Initialize(const Data& aData)
void
BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
{
if (!mDirty)
if (!IsDirty())
return;
mDirty = false;
Painted();
if (mDrawTarget) {
mDrawTarget->Flush();
@ -393,7 +393,7 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
return;
}
if (!mDirty)
if (!IsDirty())
return;
if (mGLContext &&

View File

@ -103,9 +103,9 @@ CanvasLayerD3D10::Initialize(const Data& aData)
void
CanvasLayerD3D10::UpdateSurface()
{
if (!mDirty)
if (!IsDirty())
return;
mDirty = false;
Painted();
if (mDrawTarget) {
mDrawTarget->Flush();

View File

@ -58,9 +58,9 @@ CanvasLayerD3D9::Initialize(const Data& aData)
void
CanvasLayerD3D9::UpdateSurface()
{
if (!mDirty && mTexture)
if (!IsDirty() && mTexture)
return;
mDirty = false;
Painted();
if (!mTexture) {
CreateTexture();

View File

@ -172,9 +172,9 @@ MakeIOSurfaceTexture(void* aCGIOSurfaceContext, mozilla::gl::GLContext* aGL)
void
CanvasLayerOGL::UpdateSurface()
{
if (!mDirty)
if (!IsDirty())
return;
mDirty = false;
Painted();
if (mDestroyed || mDelayedUpdates) {
return;