Bug 782786 - BasicCanvasLayer: avoid UpdateSurface of non-dirty canvases - r=BenWa

This commit is contained in:
Benoit Jacob 2012-08-23 14:56:23 -04:00
parent bd1a76ff71
commit 81cec1c6c4

View File

@ -120,6 +120,10 @@ BasicCanvasLayer::Initialize(const Data& aData)
void
BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
{
if (!mDirty)
return;
mDirty = false;
if (mDrawTarget) {
mDrawTarget->Flush();
// TODO Fix me before turning accelerated quartz canvas by default
@ -133,10 +137,6 @@ BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
return;
}
if (!mDirty)
return;
mDirty = false;
if (mGLContext) {
if (aDestSurface && aDestSurface->GetType() != gfxASurface::SurfaceTypeImage) {
NS_ASSERTION(aDestSurface->GetType() == gfxASurface::SurfaceTypeImage,
@ -229,6 +229,9 @@ BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
void
BasicCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
{
if (!mDirty)
return;
if (IsHidden())
return;
UpdateSurface();
@ -393,6 +396,9 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
return;
}
if (!mDirty)
return;
if (mGLContext &&
!mForceReadback &&
BasicManager()->GetParentBackendType() == mozilla::layers::LAYERS_OPENGL) {