зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1674029 - Only commit the dirty rects in RenderCompositorSWGL. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D96495
This commit is contained in:
Родитель
59ca2a8ce8
Коммит
912cfd9639
|
@ -98,8 +98,7 @@ bool RenderCompositorSWGL::BeginFrame() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderCompositorSWGL::CommitMappedBuffer(
|
void RenderCompositorSWGL::CommitMappedBuffer() {
|
||||||
const nsTArray<DeviceIntRect>* aDirtyRects) {
|
|
||||||
if (!mDT) {
|
if (!mDT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -109,22 +108,13 @@ void RenderCompositorSWGL::CommitMappedBuffer(
|
||||||
// If we're using a data surface, unmap it and draw it to the DT if there
|
// If we're using a data surface, unmap it and draw it to the DT if there
|
||||||
// are any supplied dirty rects.
|
// are any supplied dirty rects.
|
||||||
mSurface->Unmap();
|
mSurface->Unmap();
|
||||||
if (aDirtyRects) {
|
for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||||
if (aDirtyRects->IsEmpty()) {
|
const LayoutDeviceIntRect& dirtyRect = iter.Get();
|
||||||
gfx::Rect bounds(mSurface->GetRect());
|
gfx::Rect bounds(dirtyRect.x, dirtyRect.y, dirtyRect.width,
|
||||||
|
dirtyRect.height);
|
||||||
mDT->DrawSurface(mSurface, bounds, bounds,
|
mDT->DrawSurface(mSurface, bounds, bounds,
|
||||||
gfx::DrawSurfaceOptions(gfx::SamplingFilter::POINT),
|
gfx::DrawSurfaceOptions(gfx::SamplingFilter::POINT),
|
||||||
gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE));
|
gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE));
|
||||||
} else {
|
|
||||||
for (const DeviceIntRect& dirtyRect : *aDirtyRects) {
|
|
||||||
gfx::Rect bounds(dirtyRect.origin.x, dirtyRect.origin.y,
|
|
||||||
dirtyRect.size.width, dirtyRect.size.height);
|
|
||||||
mDT->DrawSurface(
|
|
||||||
mSurface, bounds, bounds,
|
|
||||||
gfx::DrawSurfaceOptions(gfx::SamplingFilter::POINT),
|
|
||||||
gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we had locked the DT directly. Just release the data.
|
// Otherwise, we had locked the DT directly. Just release the data.
|
||||||
|
@ -139,8 +129,16 @@ void RenderCompositorSWGL::CancelFrame() { CommitMappedBuffer(); }
|
||||||
|
|
||||||
RenderedFrameId RenderCompositorSWGL::EndFrame(
|
RenderedFrameId RenderCompositorSWGL::EndFrame(
|
||||||
const nsTArray<DeviceIntRect>& aDirtyRects) {
|
const nsTArray<DeviceIntRect>& aDirtyRects) {
|
||||||
|
if (!aDirtyRects.IsEmpty()) {
|
||||||
|
mRegion.SetEmpty();
|
||||||
|
for (auto& rect : aDirtyRects) {
|
||||||
|
mRegion.OrWith(LayoutDeviceIntRect(rect.origin.x, rect.origin.y,
|
||||||
|
rect.size.width, rect.size.height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RenderedFrameId frameId = GetNextRenderFrameId();
|
RenderedFrameId frameId = GetNextRenderFrameId();
|
||||||
CommitMappedBuffer(&aDirtyRects);
|
CommitMappedBuffer();
|
||||||
return frameId;
|
return frameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class RenderCompositorSWGL : public RenderCompositor {
|
||||||
|
|
||||||
void ClearMappedBuffer();
|
void ClearMappedBuffer();
|
||||||
|
|
||||||
void CommitMappedBuffer(const nsTArray<DeviceIntRect>* aDirtyRects = nullptr);
|
void CommitMappedBuffer();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wr
|
} // namespace wr
|
||||||
|
|
Загрузка…
Ссылка в новой задаче