зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576499
- Improve various rect things in BeginFrame implementations, no functional changes. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43367 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3ecb985fc8
Коммит
4b62be12b9
|
@ -886,11 +886,13 @@ bool BasicCompositor::BlitRenderTarget(CompositingRenderTarget* aSource,
|
|||
return true;
|
||||
}
|
||||
|
||||
void BasicCompositor::BeginFrame(
|
||||
const nsIntRegion& aInvalidRegion, const gfx::IntRect* aClipRectIn,
|
||||
const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion,
|
||||
NativeLayer* aNativeLayer, gfx::IntRect* aClipRectOut /* = nullptr */,
|
||||
gfx::IntRect* aRenderBoundsOut /* = nullptr */) {
|
||||
void BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
const IntRect* aClipRectIn,
|
||||
const IntRect& aRenderBounds,
|
||||
const nsIntRegion& aOpaqueRegion,
|
||||
NativeLayer* aNativeLayer,
|
||||
IntRect* aClipRectOut /* = nullptr */,
|
||||
IntRect* aRenderBoundsOut /* = nullptr */) {
|
||||
if (mIsPendingEndRemoteDrawing) {
|
||||
// Force to end previous remote drawing.
|
||||
TryToEndRemoteDrawing(/* aForceToEnd */ true);
|
||||
|
|
|
@ -1136,23 +1136,21 @@ void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
|
||||
EnsureSize();
|
||||
|
||||
IntRect intRect = IntRect(IntPoint(0, 0), mSize.ToUnknownSize());
|
||||
IntRect rect = IntRect(IntPoint(0, 0), mSize.ToUnknownSize());
|
||||
// Sometimes the invalid region is larger than we want to draw.
|
||||
nsIntRegion invalidRegionSafe;
|
||||
|
||||
if (mSize != oldSize) {
|
||||
invalidRegionSafe = intRect;
|
||||
invalidRegionSafe = rect;
|
||||
} else {
|
||||
invalidRegionSafe.And(aInvalidRegion, intRect);
|
||||
invalidRegionSafe.And(aInvalidRegion, rect);
|
||||
}
|
||||
|
||||
IntRect invalidRect = invalidRegionSafe.GetBounds();
|
||||
|
||||
IntRect clipRect = invalidRect;
|
||||
if (aClipRectIn) {
|
||||
clipRect.IntersectRect(
|
||||
clipRect, IntRect(aClipRectIn->X(), aClipRectIn->Y(),
|
||||
aClipRectIn->Width(), aClipRectIn->Height()));
|
||||
clipRect.IntersectRect(clipRect, *aClipRectIn);
|
||||
}
|
||||
|
||||
if (clipRect.IsEmpty()) {
|
||||
|
@ -1178,10 +1176,10 @@ void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
}
|
||||
|
||||
if (aClipRectOut) {
|
||||
*aClipRectOut = IntRect(0, 0, mSize.width, mSize.height);
|
||||
*aClipRectOut = rect;
|
||||
}
|
||||
if (aRenderBoundsOut) {
|
||||
*aRenderBoundsOut = IntRect(0, 0, mSize.width, mSize.height);
|
||||
*aRenderBoundsOut = rect;
|
||||
}
|
||||
|
||||
mCurrentClip = mBackBufferInvalid.GetBounds();
|
||||
|
|
|
@ -879,37 +879,34 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
MOZ_ASSERT(!mFrameInProgress,
|
||||
"frame still in progress (should have called EndFrame");
|
||||
|
||||
gfx::IntRect rect;
|
||||
IntRect rect;
|
||||
if (mUseExternalSurfaceSize) {
|
||||
rect = gfx::IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
|
||||
rect = IntRect(IntPoint(), mSurfaceSize);
|
||||
} else {
|
||||
rect = gfx::IntRect(aRenderBounds.X(), aRenderBounds.Y(),
|
||||
aRenderBounds.Width(), aRenderBounds.Height());
|
||||
rect = aRenderBounds;
|
||||
}
|
||||
|
||||
if (aRenderBoundsOut) {
|
||||
*aRenderBoundsOut = rect;
|
||||
}
|
||||
|
||||
auto width = rect.Width();
|
||||
auto height = rect.Height();
|
||||
|
||||
// We can't draw anything to something with no area
|
||||
// so just return
|
||||
if (width == 0 || height == 0) return;
|
||||
if (rect.IsZeroArea()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the widget size changed, we have to force a MakeCurrent
|
||||
// to make sure that GL sees the updated widget size.
|
||||
if (mWidgetSize.width != width || mWidgetSize.height != height) {
|
||||
if (mWidgetSize.ToUnknownSize() != rect.Size()) {
|
||||
MakeCurrent(ForceMakeCurrent);
|
||||
|
||||
mWidgetSize.width = width;
|
||||
mWidgetSize.height = height;
|
||||
mWidgetSize = LayoutDeviceIntSize::FromUnknownSize(rect.Size());
|
||||
} else {
|
||||
MakeCurrent();
|
||||
}
|
||||
|
||||
mPixelsPerFrame = width * height;
|
||||
mPixelsPerFrame = rect.Area();
|
||||
mPixelsFilled = 0;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
@ -952,7 +949,7 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
mWindowRenderTarget = mCurrentRenderTarget;
|
||||
|
||||
if (aClipRectOut && !aClipRectIn) {
|
||||
aClipRectOut->SetRect(0, 0, width, height);
|
||||
*aClipRectOut = IntRect(IntPoint(), rect.Size());
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
|
Загрузка…
Ссылка в новой задаче