Skip to content

Commit

Permalink
Bug 1284721 - Flush CanvasRenderingContext2D's DrawTarget before hand…
Browse files Browse the repository at this point in the history
…ing it off to the BufferProvider. r=lsalzman
  • Loading branch information
nical committed Jul 8, 2016
1 parent ff42b19 commit b51ed22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 0 additions & 3 deletions dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,6 @@ class CanvasRenderingContext2DUserData : public LayerUserData {
if (!context || !context->mTarget)
return;

// Since SkiaGL default to store drawing command until flush
// We will have to flush it before present.
context->mTarget->Flush();
context->ReturnTarget();
}

Expand Down
11 changes: 9 additions & 2 deletions gfx/layers/PersistentBufferProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ PersistentBufferProviderBasic::ReturnDrawTarget(already_AddRefed<gfx::DrawTarget
{
RefPtr<gfx::DrawTarget> dt(aDT);
MOZ_ASSERT(mDrawTarget == dt);
if (dt) {
// Since SkiaGL default to storing drawing command until flush
// we have to flush it before present.
dt->Flush();
}
return true;
}

Expand Down Expand Up @@ -205,10 +210,12 @@ PersistentBufferProviderShared::ReturnDrawTarget(already_AddRefed<gfx::DrawTarge

mBack->Unlock();

if (!mBuffer && mFront && !mFront->IsLocked()) {
mBuffer.swap(mFront);
if (mFront != mBack && !mBuffers.Contains(mFront)) {
mBuffers.AppendElement(mFront);
}

// Make mFront point to the now realized back buffer. mFront is what the next
// transaction will pick up and send to the compositor.
mFront = mBack;

return true;
Expand Down

0 comments on commit b51ed22

Please sign in to comment.