Bug 714307: Synchronize back/front buffers in gonk fallback path. r=mwu

This commit is contained in:
Chris Jones 2011-12-30 18:28:40 -08:00
parent 9b40b21432
commit 8f17266c33
3 changed files with 23 additions and 8 deletions

View File

@ -52,7 +52,9 @@
#include "android/log.h"
#include "Framebuffer.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxUtils.h"
#include "mozilla/FileUtils.h"
#include "nsTArray.h"
@ -141,7 +143,7 @@ Open(nsIntSize* aScreenSize)
}
// Clear the framebuffer to a known state.
Present();
Present(nsIntRect());
*aScreenSize = size;
return true;
@ -167,8 +169,14 @@ BackBuffer()
return Buffers()[!sActiveBuffer];
}
static gfxASurface*
FrontBuffer()
{
return Buffers()[sActiveBuffer];
}
void
Present()
Present(const nsIntRegion& aUpdated)
{
sActiveBuffer = !sActiveBuffer;
@ -178,6 +186,13 @@ Present()
if (ioctl(sFd, FBIOPUT_VSCREENINFO, &sVi) < 0) {
LOG("Error presenting front buffer");
}
nsRefPtr<gfxContext> ctx = new gfxContext(BackBuffer());
gfxUtils::PathFromRegion(ctx, aUpdated);
ctx->Clip();
ctx->SetSource(FrontBuffer());
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->Paint(1.0);
}
} // namespace Framebuffer

View File

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
class gfxASurface;
class nsIntRegion;
class nsIntSize;
namespace mozilla {
@ -71,8 +72,9 @@ void Close();
// Return the buffer to be drawn into, that will be the next frame.
gfxASurface* BackBuffer();
// Swap the front buffer for the back buffer.
void Present();
// Swap the front buffer for the back buffer. |aUpdated| is the
// region of the back buffer that was repainted.
void Present(const nsIntRegion& aUpdated);
} // namespace Framebuffer

View File

@ -111,8 +111,7 @@ nsWindow::DoDraw(void)
LayerManager* lm = gWindowToRedraw->GetLayerManager();
if (LayerManager::LAYERS_OPENGL == lm->GetBackendType()) {
static_cast<LayerManagerOGL*>(lm)->
SetClippingRegion(nsIntRegion(gScreenBounds));
static_cast<LayerManagerOGL*>(lm)->SetClippingRegion(event.region);
gWindowToRedraw->mEventCallback(&event);
} else if (LayerManager::LAYERS_BASIC == lm->GetBackendType()) {
MOZ_ASSERT(sFramebufferOpen);
@ -120,7 +119,6 @@ nsWindow::DoDraw(void)
nsRefPtr<gfxASurface> backBuffer = Framebuffer::BackBuffer();
{
nsRefPtr<gfxContext> ctx = new gfxContext(backBuffer);
ctx->NewPath();
gfxUtils::PathFromRegion(ctx, event.region);
ctx->Clip();
@ -131,7 +129,7 @@ nsWindow::DoDraw(void)
}
backBuffer->Flush();
Framebuffer::Present();
Framebuffer::Present(event.region);
} else {
NS_RUNTIMEABORT("Unexpected layer manager type");
}