diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index 2e88200539b58..0745821b7e40c 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -154,8 +154,6 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget, if (aOperator == OP_SOURCE) { aTarget->PopClip(); } - - aTarget->Flush(); } void @@ -391,6 +389,17 @@ ComputeBufferRect(const nsIntRect& aRequestedRect) return rect; } +void +RotatedContentBuffer::FlushBuffers() +{ + if (mDTBuffer) { + mDTBuffer->Flush(); + } + if (mDTBufferOnWhite) { + mDTBufferOnWhite->Flush(); + } +} + RotatedContentBuffer::PaintState RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, uint32_t aFlags) diff --git a/gfx/layers/RotatedBuffer.h b/gfx/layers/RotatedBuffer.h index a371f1ce9b34e..2dbeeeda5a28d 100644 --- a/gfx/layers/RotatedBuffer.h +++ b/gfx/layers/RotatedBuffer.h @@ -75,6 +75,8 @@ class RotatedBuffer { BUFFER_WHITE, // The buffer with white background, only valid with component alpha. BUFFER_BOTH // The combined black/white buffers, only valid for writing operations, not reading. }; + // It is the callers repsonsibility to ensure aTarget is flushed after calling + // this method. void DrawBufferWithRotation(gfx::DrawTarget* aTarget, ContextSource aSource, float aOpacity = 1.0, gfx::CompositionOp aOperator = gfx::OP_OVER, @@ -396,6 +398,10 @@ class RotatedContentBuffer : public RotatedBuffer */ bool EnsureBuffer(); bool EnsureBufferOnWhite(); + + // Flush our buffers if they are mapped. + void FlushBuffers(); + /** * True if we have a buffer where we can get it (but not necessarily * mapped currently). diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index b9ed4a01a66d2..bba3f54fe5b08 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -598,6 +598,8 @@ ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer() mFrontBufferRect, mFrontBufferRotation); UpdateDestinationFrom(frontBuffer, updateRegion); + // We need to flush our buffers before we unlock our front textures + FlushBuffers(); mFrontClient->Unlock(); if (mFrontClientOnWhite) { mFrontClientOnWhite->Unlock(); @@ -816,6 +818,9 @@ DeprecatedContentClientDoubleBuffered::SyncFrontBufferToBackBuffer() mFrontBufferRotation); UpdateDestinationFrom(frontBuffer, updateRegion); + // We need to flush our buffers before we unlock our front textures + FlushBuffers(); + mFrontAndBackBufferDiffer = false; }