зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1687124 - Make RenderCompositorSWGL clear the non-opaque dirty areas. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D102666
This commit is contained in:
Родитель
eb7fe574cb
Коммит
05e2b31dac
|
@ -10,6 +10,8 @@
|
|||
#include "mozilla/widget/CompositorWidget.h"
|
||||
|
||||
namespace mozilla {
|
||||
using namespace gfx;
|
||||
|
||||
namespace wr {
|
||||
|
||||
/* static */
|
||||
|
@ -53,7 +55,8 @@ bool RenderCompositorSWGL::BeginFrame() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RenderCompositorSWGL::AllocateMappedBuffer() {
|
||||
bool RenderCompositorSWGL::AllocateMappedBuffer(
|
||||
const wr::DeviceIntRect* aOpaqueRects, size_t aNumOpaqueRects) {
|
||||
// Request a new draw target to use from the widget...
|
||||
MOZ_ASSERT(!mDT);
|
||||
layers::BufferMode bufferMode = layers::BufferMode::BUFFERED;
|
||||
|
@ -113,6 +116,25 @@ bool RenderCompositorSWGL::AllocateMappedBuffer() {
|
|||
MOZ_ASSERT(mMappedData != nullptr && mMappedStride > 0);
|
||||
wr_swgl_init_default_framebuffer(mContext, bounds.x, bounds.y, bounds.width,
|
||||
bounds.height, mMappedStride, mMappedData);
|
||||
|
||||
LayoutDeviceIntRegion opaque;
|
||||
for (size_t i = 0; i < aNumOpaqueRects; i++) {
|
||||
const auto& rect = aOpaqueRects[i];
|
||||
opaque.OrWith(LayoutDeviceIntRect(rect.origin.x, rect.origin.y,
|
||||
rect.size.width, rect.size.height));
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> dt = gfx::Factory::CreateDrawTargetForData(
|
||||
BackendType::SKIA, mMappedData, bounds.Size().ToUnknownSize(),
|
||||
mMappedStride, SurfaceFormat::B8G8R8A8, false);
|
||||
|
||||
LayoutDeviceIntRegion clear;
|
||||
clear.Sub(mRegion, opaque);
|
||||
for (auto iter = clear.RectIter(); !iter.Done(); iter.Next()) {
|
||||
dt->ClearRect(
|
||||
IntRectToRect((iter.Get() - bounds.TopLeft()).ToUnknownRect()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -140,7 +162,7 @@ void RenderCompositorSWGL::StartCompositing(
|
|||
// Now that the dirty rects have been supplied and the composition region
|
||||
// is known, allocate and install a framebuffer encompassing the composition
|
||||
// region.
|
||||
if (!AllocateMappedBuffer()) {
|
||||
if (!AllocateMappedBuffer(aOpaqueRects, aNumOpaqueRects)) {
|
||||
gfxCriticalNote
|
||||
<< "RenderCompositorSWGL failed mapping default framebuffer";
|
||||
// If allocation of the mapped default framebuffer failed, then just install
|
||||
|
|
|
@ -67,7 +67,8 @@ class RenderCompositorSWGL : public RenderCompositor {
|
|||
|
||||
void ClearMappedBuffer();
|
||||
|
||||
bool AllocateMappedBuffer();
|
||||
bool AllocateMappedBuffer(const wr::DeviceIntRect* aOpaqueRects,
|
||||
size_t aNumOpaqueRects);
|
||||
|
||||
void CommitMappedBuffer(bool aDirty = true);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче