Skip to content

Commit

Permalink
Bug 951556. Don't do multiple flushes due to DrawBufferWithRotation. …
Browse files Browse the repository at this point in the history
…r=mattwoodrow
  • Loading branch information
nrc committed Jan 9, 2014
1 parent a992457 commit 311fe4a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gfx/layers/RotatedBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
if (aOperator == OP_SOURCE) {
aTarget->PopClip();
}

aTarget->Flush();
}

void
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions gfx/layers/RotatedBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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).
Expand Down
5 changes: 5 additions & 0 deletions gfx/layers/client/ContentClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 311fe4a

Please sign in to comment.