Bug 680126 Use ColorLayers for presshell painting and correct painting area r=roc

This commit is contained in:
Benjamin Stover 2011-08-23 15:59:43 -07:00
parent 61b7a3150e
commit 6eb3d9db4c

View File

@ -4813,16 +4813,6 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
if (rootPresContext) {
rootPresContext->UpdatePluginGeometry();
}
#ifdef DEBUG
if (!mIsDestroying) {
nsIView* rootView = mViewManager->GetRootView();
if (rootView) {
nsRect bounds = rootView->GetBounds();
NS_ASSERTION(bounds.Size() == mPresContext->GetVisibleArea().Size(),
"root view / pres context visible size mismatch");
}
}
#endif
}
PRUint32 updateFlags = NS_VMREFRESH_NO_SYNC;
@ -6092,21 +6082,6 @@ PresShell::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
}
}
static void DrawThebesLayer(ThebesLayer* aLayer,
gfxContext* aContext,
const nsIntRegion& aRegionToDraw,
const nsIntRegion& aRegionToInvalidate,
void* aCallbackData)
{
PaintParams* params = static_cast<PaintParams*>(aCallbackData);
aContext->NewPath();
aContext->SetColor(gfxRGBA(params->mBackgroundColor));
nsIntRect dirtyRect = aRegionToDraw.GetBounds();
aContext->Rectangle(
gfxRect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height));
aContext->Fill();
}
NS_IMETHODIMP
PresShell::Paint(nsIView* aViewToPaint,
nsIWidget* aWidgetToPaint,
@ -6153,11 +6128,9 @@ PresShell::Paint(nsIView* aViewToPaint,
if (layerManager->EndEmptyTransaction()) {
frame->UpdatePaintCountForPaintedPresShells();
presContext->NotifyDidPaintForSubtree();
return NS_OK;
}
}
frame->RemoveStateBits(NS_FRAME_UPDATE_LAYER_TREE);
}
@ -6187,14 +6160,17 @@ PresShell::Paint(nsIView* aViewToPaint,
return NS_OK;
}
nsRefPtr<ThebesLayer> root = layerManager->CreateThebesLayer();
nsRefPtr<ColorLayer> root = layerManager->CreateColorLayer();
if (root) {
root->SetVisibleRegion(aIntDirtyRegion);
nsPresContext* pc = GetPresContext();
nsIntRect bounds =
pc->GetVisibleArea().ToOutsidePixels(pc->AppUnitsPerDevPixel());
bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor);
root->SetColor(bgcolor);
root->SetVisibleRegion(bounds);
layerManager->SetRoot(root);
}
bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor);
PaintParams params = { bgcolor };
layerManager->EndTransaction(DrawThebesLayer, &params);
layerManager->EndTransaction(NULL, NULL);
presContext->NotifyDidPaintForSubtree();
return NS_OK;