зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1573343 - Move draw target clearing out of GetBackBufferDrawTarget. r=mattwoodrow
On Windows, where the DrawTarget is rewrapped in a Cairo/pixman DrawTarget, this will now cause Cairo/pixman to be used for the clear. Differential Revision: https://phabricator.services.mozilla.com/D41673 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2dbe70d234
Коммит
19c25b1d89
|
@ -305,9 +305,10 @@ BasicCompositor::CreateRenderTargetForWindow(
|
|||
RefPtr<BasicCompositingRenderTarget> rt;
|
||||
IntRect rect = aRect.ToUnknownRect();
|
||||
|
||||
bool isCleared = false;
|
||||
if (aBufferMode != BufferMode::BUFFER_NONE) {
|
||||
RefPtr<DrawTarget> target =
|
||||
mWidget->GetBackBufferDrawTarget(mDrawTarget, aRect, aClearRect);
|
||||
mWidget->GetBackBufferDrawTarget(mDrawTarget, aRect, &isCleared);
|
||||
if (!target) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -320,10 +321,10 @@ BasicCompositor::CreateRenderTargetForWindow(
|
|||
windowRect.ExpandToEnclose(IntPoint(0, 0));
|
||||
}
|
||||
rt = new BasicCompositingRenderTarget(mDrawTarget, windowRect);
|
||||
if (!aClearRect.IsEmpty()) {
|
||||
IntRect clearRect = aClearRect.ToUnknownRect();
|
||||
mDrawTarget->ClearRect(Rect(clearRect - rt->GetOrigin()));
|
||||
}
|
||||
}
|
||||
if (!aClearRect.IsEmpty() && !isCleared) {
|
||||
gfx::IntRect clearRect = aClearRect.ToUnknownRect() - rt->GetOrigin();
|
||||
rt->mDrawTarget->ClearRect(gfx::Rect(clearRect));
|
||||
}
|
||||
|
||||
return rt.forget();
|
||||
|
|
|
@ -23,7 +23,7 @@ void CompositorWidget::CleanupRemoteDrawing() { mLastBackBuffer = nullptr; }
|
|||
|
||||
already_AddRefed<gfx::DrawTarget> CompositorWidget::GetBackBufferDrawTarget(
|
||||
gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect,
|
||||
const LayoutDeviceIntRect& aClearRect) {
|
||||
bool* aOutIsCleared) {
|
||||
MOZ_ASSERT(aScreenTarget);
|
||||
gfx::SurfaceFormat format =
|
||||
aScreenTarget->GetFormat() == gfx::SurfaceFormat::B8G8R8X8
|
||||
|
@ -32,24 +32,17 @@ already_AddRefed<gfx::DrawTarget> CompositorWidget::GetBackBufferDrawTarget(
|
|||
gfx::IntSize size = aRect.ToUnknownRect().Size();
|
||||
gfx::IntSize clientSize = Max(size, GetClientSize().ToUnknownSize());
|
||||
|
||||
RefPtr<gfx::DrawTarget> target;
|
||||
*aOutIsCleared = false;
|
||||
// Re-use back buffer if possible
|
||||
if (mLastBackBuffer &&
|
||||
mLastBackBuffer->GetBackendType() == aScreenTarget->GetBackendType() &&
|
||||
mLastBackBuffer->GetFormat() == format &&
|
||||
mLastBackBuffer->GetSize() == clientSize) {
|
||||
target = mLastBackBuffer;
|
||||
if (!aClearRect.IsEmpty()) {
|
||||
gfx::IntRect clearRect =
|
||||
aClearRect.ToUnknownRect() - aRect.ToUnknownRect().TopLeft();
|
||||
target->ClearRect(gfx::Rect(clearRect.X(), clearRect.Y(),
|
||||
clearRect.Width(), clearRect.Height()));
|
||||
}
|
||||
} else {
|
||||
target = aScreenTarget->CreateSimilarDrawTarget(clientSize, format);
|
||||
mLastBackBuffer = target;
|
||||
if (!mLastBackBuffer ||
|
||||
mLastBackBuffer->GetBackendType() != aScreenTarget->GetBackendType() ||
|
||||
mLastBackBuffer->GetFormat() != format ||
|
||||
mLastBackBuffer->GetSize() != clientSize) {
|
||||
mLastBackBuffer =
|
||||
aScreenTarget->CreateSimilarDrawTarget(clientSize, format);
|
||||
*aOutIsCleared = true;
|
||||
}
|
||||
return target.forget();
|
||||
return do_AddRef(mLastBackBuffer);
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::SourceSurface> CompositorWidget::EndBackBufferDrawing() {
|
||||
|
|
|
@ -236,7 +236,7 @@ class CompositorWidget {
|
|||
*/
|
||||
virtual already_AddRefed<gfx::DrawTarget> GetBackBufferDrawTarget(
|
||||
gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect,
|
||||
const LayoutDeviceIntRect& aClearRect);
|
||||
bool* aOutIsCleared);
|
||||
|
||||
/**
|
||||
* Ensure end of composition to back buffer.
|
||||
|
|
|
@ -158,11 +158,11 @@ bool WinCompositorWidget::NeedsToDeferEndRemoteDrawing() {
|
|||
|
||||
already_AddRefed<gfx::DrawTarget> WinCompositorWidget::GetBackBufferDrawTarget(
|
||||
gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect,
|
||||
const LayoutDeviceIntRect& aClearRect) {
|
||||
bool* aOutIsCleared) {
|
||||
MOZ_ASSERT(!mLockedBackBufferData);
|
||||
|
||||
RefPtr<gfx::DrawTarget> target = CompositorWidget::GetBackBufferDrawTarget(
|
||||
aScreenTarget, aRect, aClearRect);
|
||||
aScreenTarget, aRect, aOutIsCleared);
|
||||
if (!target) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class WinCompositorWidget : public CompositorWidget,
|
|||
LayoutDeviceIntSize GetClientSize() override;
|
||||
already_AddRefed<gfx::DrawTarget> GetBackBufferDrawTarget(
|
||||
gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect,
|
||||
const LayoutDeviceIntRect& aClearRect) override;
|
||||
bool* aOutIsCleared) override;
|
||||
already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing() override;
|
||||
bool InitCompositor(layers::Compositor* aCompositor) override;
|
||||
uintptr_t GetWidgetKey() override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче