Bug 1704431 - Handle start compositing only when dirty rect exists r=lsalzman,gfx-reviewers

When render_impl is called from update, the device_size is None, and so dirty rect calculation is skipped. Then if RenderCompositorLayersSWGL does not handle start compositing when dirty rect does not exist, we could ignore StartCompositing() from update.

Differential Revision: https://phabricator.services.mozilla.com/D111583
This commit is contained in:
sotaro 2021-04-13 03:31:03 +00:00
Родитель 3003d0968b
Коммит 0a52a8db04
1 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -75,21 +75,23 @@ void RenderCompositorLayersSWGL::CancelFrame() {
void RenderCompositorLayersSWGL::StartCompositing(
const wr::DeviceIntRect* aDirtyRects, size_t aNumDirtyRects,
const wr::DeviceIntRect* aOpaqueRects, size_t aNumOpaqueRects) {
if (!mInFrame) {
MOZ_RELEASE_ASSERT(!mCompositingStarted);
if (!mInFrame || aNumDirtyRects == 0) {
return;
}
gfx::IntRect bounds(gfx::IntPoint(0, 0), GetBufferSize().ToUnknownSize());
nsIntRegion dirty;
if (aNumDirtyRects) {
for (size_t i = 0; i < aNumDirtyRects; i++) {
const auto& rect = aDirtyRects[i];
dirty.OrWith(gfx::IntRect(rect.origin.x, rect.origin.y, rect.size.width,
rect.size.height));
}
dirty.AndWith(bounds);
} else {
dirty = bounds;
MOZ_RELEASE_ASSERT(aNumDirtyRects > 0);
for (size_t i = 0; i < aNumDirtyRects; i++) {
const auto& rect = aDirtyRects[i];
dirty.OrWith(gfx::IntRect(rect.origin.x, rect.origin.y, rect.size.width,
rect.size.height));
}
dirty.AndWith(bounds);
nsIntRegion opaque(bounds);
opaque.SubOut(mWidget->GetTransparentRegion().ToUnknownRegion());
for (size_t i = 0; i < aNumOpaqueRects; i++) {