зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1728914 - Convert painting entrance points to use WebRenderLayerManager directly. r=gfx-reviewers,aosmond
Depends on D124417 Differential Revision: https://phabricator.services.mozilla.com/D124418
This commit is contained in:
Родитель
3b71aff051
Коммит
de15de8fe8
|
@ -6277,7 +6277,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
|
|||
|
||||
WindowRenderer* renderer = aViewToPaint->GetWidget()->GetWindowRenderer();
|
||||
NS_ASSERTION(renderer, "Must be in paint event");
|
||||
LayerManager* layerManager = renderer->AsLayerManager();
|
||||
WebRenderLayerManager* layerManager = renderer->AsWebRender();
|
||||
bool shouldInvalidate = renderer->NeedsWidgetInvalidation();
|
||||
|
||||
nsAutoNotifyDidPaint notifyDidPaint(this, aFlags);
|
||||
|
@ -6318,7 +6318,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
|
|||
!frame->HasAnyStateBits(NS_FRAME_UPDATE_LAYER_TREE) &&
|
||||
!mNextPaintCompressed) {
|
||||
if (layerManager) {
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
layerManager->SetTransactionIdAllocator(presContext->RefreshDriver());
|
||||
}
|
||||
|
||||
if (renderer->EndEmptyTransaction((aFlags & PaintFlags::PaintComposite)
|
||||
|
@ -6374,7 +6374,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
|
|||
wr::ToColorF(ToDeviceColor(bgcolor)));
|
||||
WrFiltersHolder wrFilters;
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
layerManager->SetTransactionIdAllocator(presContext->RefreshDriver());
|
||||
layerManager->AsWebRenderLayerManager()->EndTransactionWithoutLayer(
|
||||
nullptr, nullptr, std::move(wrFilters), &data, 0);
|
||||
return;
|
||||
|
|
|
@ -8516,18 +8516,6 @@ void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2,
|
|||
aDrawTarget.StrokeLine(p1, p2, aPattern, aStrokeOptions, aDrawOptions);
|
||||
}
|
||||
|
||||
namespace layout {
|
||||
|
||||
void MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager,
|
||||
nsPresContext* aPresContext) {
|
||||
auto backendType = aManager->GetBackendType();
|
||||
if (backendType == LayersBackend::LAYERS_CLIENT ||
|
||||
backendType == LayersBackend::LAYERS_WR) {
|
||||
aManager->SetTransactionIdAllocator(aPresContext->RefreshDriver());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layout
|
||||
} // namespace mozilla
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -3155,9 +3155,6 @@ class AutoMaybeDisableFontInflation {
|
|||
bool mOldValue;
|
||||
};
|
||||
|
||||
void MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager,
|
||||
nsPresContext* aPresContext);
|
||||
|
||||
} // namespace layout
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -2333,7 +2333,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
Maybe<double> aDisplayListBuildTime) {
|
||||
AUTO_PROFILER_LABEL("nsDisplayList::PaintRoot", GRAPHICS);
|
||||
|
||||
RefPtr<LayerManager> layerManager;
|
||||
RefPtr<WebRenderLayerManager> layerManager;
|
||||
WindowRenderer* renderer = nullptr;
|
||||
bool widgetTransaction = false;
|
||||
bool doBeginTransaction = true;
|
||||
|
@ -2347,11 +2347,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
MOZ_ASSERT(!(aFlags & PAINT_EXISTING_TRANSACTION));
|
||||
renderer = nullptr;
|
||||
} else {
|
||||
layerManager = renderer->AsLayerManager();
|
||||
if (layerManager) {
|
||||
layerManager->SetContainsSVG(false);
|
||||
}
|
||||
|
||||
layerManager = renderer->AsWebRender();
|
||||
doBeginTransaction = !(aFlags & PAINT_EXISTING_TRANSACTION);
|
||||
widgetTransaction = true;
|
||||
}
|
||||
|
@ -2383,19 +2379,18 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
MOZ_ASSERT(layerManager);
|
||||
if (doBeginTransaction) {
|
||||
if (aCtx) {
|
||||
if (!layerManager->BeginTransactionWithTarget(aCtx)) {
|
||||
if (!layerManager->BeginTransactionWithTarget(aCtx, nsCString())) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
if (!layerManager->BeginTransaction()) {
|
||||
if (!layerManager->BeginTransaction(nsCString())) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool prevIsCompositingCheap =
|
||||
aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
bool prevIsCompositingCheap = aBuilder->SetIsCompositingCheap(true);
|
||||
layerManager->SetTransactionIdAllocator(presContext->RefreshDriver());
|
||||
|
||||
bool sent = false;
|
||||
if (aFlags & PAINT_IDENTICAL_DISPLAY_LIST) {
|
||||
|
@ -2444,16 +2439,13 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
return layerManager.forget();
|
||||
}
|
||||
|
||||
FallbackRenderer* fallback = renderer->AsFallback();
|
||||
MOZ_ASSERT(fallback);
|
||||
|
||||
if (doBeginTransaction) {
|
||||
if (aCtx) {
|
||||
MOZ_ASSERT(layerManager);
|
||||
if (!layerManager->BeginTransactionWithTarget(aCtx)) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
if (!renderer->BeginTransaction()) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(!aCtx);
|
||||
if (!fallback->BeginTransaction()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2463,20 +2455,8 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
flags = LayerManager::END_NO_COMPOSITE;
|
||||
}
|
||||
|
||||
if (layerManager) {
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
}
|
||||
|
||||
bool sent = false;
|
||||
if (aFlags & PAINT_IDENTICAL_DISPLAY_LIST) {
|
||||
sent = renderer->EndEmptyTransaction(flags);
|
||||
}
|
||||
|
||||
if (!sent) {
|
||||
MOZ_ASSERT(renderer->AsFallback());
|
||||
renderer->AsFallback()->EndTransactionWithList(
|
||||
aBuilder, this, presContext->AppUnitsPerDevPixel(), flags);
|
||||
}
|
||||
fallback->EndTransactionWithList(aBuilder, this,
|
||||
presContext->AppUnitsPerDevPixel(), flags);
|
||||
|
||||
if (widgetTransaction ||
|
||||
// SVG-as-an-image docs don't paint as part of the retained layer tree,
|
||||
|
@ -2495,22 +2475,14 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
bool shouldInvalidate = renderer->NeedsWidgetInvalidation();
|
||||
if (view) {
|
||||
if (shouldInvalidate) {
|
||||
if (!renderer->AsFallback()) {
|
||||
view->GetViewManager()->InvalidateView(view);
|
||||
} else {
|
||||
// If we're the fallback renderer, then we don't need to invalidate
|
||||
// as we've just drawn directly to the window and don't need to do
|
||||
// anything else.
|
||||
NS_ASSERTION(!(aFlags & PAINT_NO_COMPOSITE),
|
||||
"Must be compositing during fallback");
|
||||
}
|
||||
// If we're the fallback renderer, then we don't need to invalidate
|
||||
// as we've just drawn directly to the window and don't need to do
|
||||
// anything else.
|
||||
NS_ASSERTION(!(aFlags & PAINT_NO_COMPOSITE),
|
||||
"Must be compositing during fallback");
|
||||
}
|
||||
}
|
||||
|
||||
if (layerManager) {
|
||||
layerManager->SetUserData(&gLayerManagerLayerBuilder, nullptr);
|
||||
}
|
||||
return layerManager.forget();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsDisplayItem* nsDisplayList::RemoveBottom() {
|
||||
|
|
|
@ -1138,21 +1138,6 @@ void nsWebBrowser::EnsureDocShellTreeOwner() {
|
|||
mDocShellTreeOwner->WebBrowser(this);
|
||||
}
|
||||
|
||||
static void DrawPaintedLayer(PaintedLayer* aLayer, gfxContext* aContext,
|
||||
const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aDirtyRegion,
|
||||
DrawRegionClip aClip,
|
||||
const nsIntRegion& aRegionToInvalidate,
|
||||
void* aCallbackData) {
|
||||
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
|
||||
|
||||
ColorPattern color(ToDeviceColor(*static_cast<nscolor*>(aCallbackData)));
|
||||
nsIntRect dirtyRect = aRegionToDraw.GetBounds();
|
||||
aDrawTarget.FillRect(
|
||||
Rect(dirtyRect.X(), dirtyRect.Y(), dirtyRect.Width(), dirtyRect.Height()),
|
||||
color);
|
||||
}
|
||||
|
||||
void nsWebBrowser::WindowActivated() {
|
||||
#if defined(DEBUG_smaug)
|
||||
RefPtr<dom::Document> document = mDocShell->GetDocument();
|
||||
|
@ -1186,19 +1171,7 @@ bool nsWebBrowser::PaintWindow(nsIWidget* aWidget,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
LayerManager* layerManager = renderer->AsLayerManager();
|
||||
NS_ASSERTION(layerManager, "Must be in paint event");
|
||||
|
||||
layerManager->BeginTransaction();
|
||||
RefPtr<PaintedLayer> root = layerManager->CreatePaintedLayer();
|
||||
if (root) {
|
||||
nsIntRect dirtyRect = aRegion.GetBounds().ToUnknownRect();
|
||||
root->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(dirtyRect));
|
||||
layerManager->SetRoot(root);
|
||||
}
|
||||
|
||||
layerManager->EndTransaction(DrawPaintedLayer, &mBackgroundColor);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void nsWebBrowser::FocusActivate(uint64_t aActionId) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче