From af23265853fe95f3d04aa8681b98f1e656df2925 Mon Sep 17 00:00:00 2001 From: Nicholas Cameron Date: Fri, 9 Aug 2013 11:30:18 +1200 Subject: [PATCH] Bug 901404. Support Azure with single buffered thebes layers. r=mattwoodrow --- gfx/layers/ThebesLayerBuffer.h | 24 ++++++++++++++ gfx/layers/client/ContentClient.cpp | 49 ++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/gfx/layers/ThebesLayerBuffer.h b/gfx/layers/ThebesLayerBuffer.h index f8f6c48c9e9..2b76bf0b631 100644 --- a/gfx/layers/ThebesLayerBuffer.h +++ b/gfx/layers/ThebesLayerBuffer.h @@ -245,6 +245,8 @@ public: */ gfxASurface* GetBuffer() { return mBuffer; } gfxASurface* GetBufferOnWhite() { return mBufferOnWhite; } + gfx::DrawTarget* GetDTBuffer() { return mDTBuffer; } + gfx::DrawTarget* GetDTBufferOnWhite() { return mDTBufferOnWhite; } /** * Complete the drawing operation. The region to draw must have been @@ -271,11 +273,33 @@ protected: already_AddRefed SetBufferOnWhite(gfxASurface* aBuffer) { + MOZ_ASSERT(!SupportsAzureContent()); nsRefPtr tmp = mBufferOnWhite.forget(); mBufferOnWhite = aBuffer; return tmp.forget(); } + TemporaryRef + SetDTBuffer(gfx::DrawTarget* aBuffer, + const nsIntRect& aBufferRect, const nsIntPoint& aBufferRotation) + { + MOZ_ASSERT(SupportsAzureContent()); + RefPtr tmp = mDTBuffer.forget(); + mDTBuffer = aBuffer; + mBufferRect = aBufferRect; + mBufferRotation = aBufferRotation; + return tmp.forget(); + } + + TemporaryRef + SetDTBufferOnWhite(gfx::DrawTarget* aBuffer) + { + MOZ_ASSERT(SupportsAzureContent()); + RefPtr tmp = mDTBufferOnWhite.forget(); + mDTBufferOnWhite = aBuffer; + return tmp.forget(); + } + /** * Set the texture client only. This is used with surfaces that * require explicit lock/unlock, which |aClient| is used to do on diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 5c2ae2bb57e..2679b2d1e52 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -545,23 +545,42 @@ ContentClientSingleBuffered::SyncFrontBufferToBackBuffer() return; } - gfxASurface* backBuffer = GetBuffer(); - if (!backBuffer && mDeprecatedTextureClient) { - backBuffer = mDeprecatedTextureClient->LockSurface(); + if (SupportsAzureContent()) { + DrawTarget* backBuffer = GetDTBuffer(); + if (!backBuffer && mDeprecatedTextureClient) { + backBuffer = mDeprecatedTextureClient->LockDrawTarget(); + } + + RefPtr oldBuffer; + oldBuffer = SetDTBuffer(backBuffer, + mBufferRect, + mBufferRotation); + + backBuffer = GetDTBufferOnWhite(); + if (!backBuffer && mDeprecatedTextureClientOnWhite) { + backBuffer = mDeprecatedTextureClientOnWhite->LockDrawTarget(); + } + + oldBuffer = SetDTBufferOnWhite(backBuffer); + } else { + gfxASurface* backBuffer = GetBuffer(); + if (!backBuffer && mDeprecatedTextureClient) { + backBuffer = mDeprecatedTextureClient->LockSurface(); + } + + nsRefPtr oldBuffer; + oldBuffer = SetBuffer(backBuffer, + mBufferRect, + mBufferRotation); + + backBuffer = GetBufferOnWhite(); + if (!backBuffer && mDeprecatedTextureClientOnWhite) { + backBuffer = mDeprecatedTextureClientOnWhite->LockSurface(); + } + + oldBuffer = SetBufferOnWhite(backBuffer); } - nsRefPtr oldBuffer; - oldBuffer = SetBuffer(backBuffer, - mBufferRect, - mBufferRotation); - - backBuffer = GetBufferOnWhite(); - if (!backBuffer && mDeprecatedTextureClientOnWhite) { - backBuffer = mDeprecatedTextureClientOnWhite->LockSurface(); - } - - oldBuffer = SetBufferOnWhite(backBuffer); - mIsNewBuffer = false; mFrontAndBackBufferDiffer = false; }