Remove PaintState::mDidSelfCopy. (
bug 1409871 part 9, r=nical)
Miscellaneous cleanup, PaintState doesn't need to know this as no one uses
this information outside of the content client classes.
MozReview-Commit-ID: 6K8LxEPvp4V
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -742,17 +742,16 @@ RotatedContentBuffer::BeginPaint(Painted
mDTBuffer->CopyRect(srcRect, dest);
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!EnsureBufferOnWhite()) {
return result;
}
MOZ_ASSERT(mDTBufferOnWhite && mDTBufferOnWhite->IsValid());
mDTBufferOnWhite->CopyRect(srcRect, dest);
}
- result.mDidSelfCopy = true;
mDidSelfCopy = true;
// Don't set destBuffer; we special-case self-copies, and
// just did the necessary work above.
mBufferRect = destBufferRect;
} else {
// With azure and a data surface perform an buffer unrotate
// (SelfCopy).
unsigned char* data;
@@ -779,23 +778,22 @@ RotatedContentBuffer::BeginPaint(Painted
size.width * bytesPerPixel,
size.height, stride,
newRotation.x * bytesPerPixel, newRotation.y);
mDTBufferOnWhite->ReleaseBits(data);
}
// Buffer unrotate moves all the pixels, note that
// we self copied for SyncBackToFrontBuffer
- result.mDidSelfCopy = true;
mDidSelfCopy = true;
mBufferRect = destBufferRect;
mBufferRotation = IntPoint(0, 0);
}
- if (!result.mDidSelfCopy) {
+ if (!mDidSelfCopy) {
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
CreateBuffer(result.mContentType, destBufferRect, bufferFlags,
&destDTBuffer, &destDTBufferOnWhite);
if (!destDTBuffer ||
(!destDTBufferOnWhite && (bufferFlags & BUFFER_COMPONENT_ALPHA))) {
if (Factory::ReasonableSurfaceSize(IntSize(destBufferRect.Width(), destBufferRect.Height()))) {
gfxCriticalNote << "Failed 1 buffer db=" << hexa(destDTBuffer.get()) << " dw=" << hexa(destDTBufferOnWhite.get()) << " for " << destBufferRect.x << ", " << destBufferRect.y << ", " << destBufferRect.Width() << ", " << destBufferRect.Height();
}
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -334,35 +334,32 @@ public:
}
/**
* This is returned by BeginPaint. The caller should draw into mTarget.
* mRegionToDraw must be drawn. mRegionToInvalidate has been invalidated
* by RotatedContentBuffer and must be redrawn on the screen.
* mRegionToInvalidate is set when the buffer has changed from
* opaque to transparent or vice versa, since the details of rendering can
- * depend on the buffer type. mDidSelfCopy is true if we kept our buffer
- * but used MovePixels() to shift its content.
+ * depend on the buffer type.
*/
struct PaintState {
PaintState()
: mRegionToDraw()
, mRegionToInvalidate()
, mMode(SurfaceMode::SURFACE_NONE)
, mClip(DrawRegionClip::NONE)
, mContentType(gfxContentType::SENTINEL)
- , mDidSelfCopy(false)
{}
nsIntRegion mRegionToDraw;
nsIntRegion mRegionToInvalidate;
SurfaceMode mMode;
DrawRegionClip mClip;
ContentType mContentType;
- bool mDidSelfCopy;
};
enum {
PAINT_WILL_RESAMPLE = 0x01,
PAINT_NO_ROTATION = 0x02,
PAINT_CAN_DRAW_ROTATED = 0x04
};
/**
--- a/gfx/layers/basic/BasicPaintedLayer.cpp
+++ b/gfx/layers/basic/BasicPaintedLayer.cpp
@@ -177,17 +177,16 @@ BasicPaintedLayer::Validate(LayerManager
RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds());
RefPtr<gfxContext> ctx = gfxContext::CreatePreservingTransformOrNull(target);
MOZ_ASSERT(ctx); // already checked the target above
PaintBuffer(ctx,
state.mRegionToDraw, state.mRegionToDraw, state.mRegionToInvalidate,
- state.mDidSelfCopy,
state.mClip,
aCallback, aCallbackData);
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this));
Mutated();
ctx = nullptr;
mContentClient->ReturnDrawTargetToBuffer(target);
target = nullptr;
--- a/gfx/layers/basic/BasicPaintedLayer.h
+++ b/gfx/layers/basic/BasicPaintedLayer.h
@@ -98,17 +98,16 @@ public:
}
protected:
virtual void
PaintBuffer(gfxContext* aContext,
const nsIntRegion& aRegionToDraw,
const nsIntRegion& aExtendedRegionToDraw,
const nsIntRegion& aRegionToInvalidate,
- bool aDidSelfCopy,
DrawRegionClip aClip,
LayerManager::DrawPaintedLayerCallback aCallback,
void* aCallbackData)
{
if (!aCallback) {
BasicManager()->SetTransactionIncomplete();
return;
}
--- a/gfx/layers/client/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -85,18 +85,17 @@ ClientPaintedLayer::UpdateContentClient(
static_cast<ContentClientRemoteBuffer *>(mContentClient.get());
MOZ_ASSERT(contentClientRemote->GetIPCHandle());
// Hold(this) ensures this layer is kept alive through the current transaction
// The ContentClient assumes this layer is kept alive (e.g., in CreateBuffer),
// so deleting this Hold for whatever reason will break things.
ClientManager()->Hold(this);
contentClientRemote->Updated(aState.mRegionToDraw,
- mVisibleRegion.ToUnknownRegion(),
- aState.mDidSelfCopy);
+ mVisibleRegion.ToUnknownRegion());
}
bool
ClientPaintedLayer::UpdatePaintRegion(PaintState& aState)
{
SubtractFromValidRegion(aState.mRegionToInvalidate);
if (!aState.mRegionToDraw.IsEmpty() && !ClientManager()->GetPaintedLayerCallback()) {
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -410,21 +410,20 @@ ContentClientRemoteBuffer::CreateBuffer(
MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
*aWhiteDT = mTextureClientOnWhite->BorrowDrawTarget();
}
}
nsIntRegion
ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy)
+ const nsIntRegion& aVisibleRegion)
{
nsIntRegion updatedRegion;
- if (mIsNewBuffer || aDidSelfCopy) {
+ if (mIsNewBuffer || mDidSelfCopy) {
// A buffer reallocation clears both buffers. The front buffer has all the
// content by now, but the back buffer is still clear. Here, in effect, we
// are saying to copy all of the pixels of the front buffer to the back.
// Also when we self-copied in the buffer, the buffer space
// changes and some changed buffer content isn't reflected in the
// draw or invalidate region (on purpose!). When this happens, we
// need to read back the entire buffer too.
updatedRegion = aVisibleRegion.GetBounds();
@@ -437,22 +436,20 @@ ContentClientRemoteBuffer::GetUpdatedReg
"Update outside of buffer rect!");
MOZ_ASSERT(mTextureClient, "should have a back buffer by now");
return updatedRegion;
}
void
ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy)
+ const nsIntRegion& aVisibleRegion)
{
nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
- aVisibleRegion,
- aDidSelfCopy);
+ aVisibleRegion);
MOZ_ASSERT(mTextureClient);
if (mTextureClientOnWhite) {
mForwarder->UseComponentAlphaTextures(this, mTextureClient,
mTextureClientOnWhite);
} else {
AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
@@ -545,24 +542,16 @@ ContentClientDoubleBuffered::DestroyFron
mOldTextures.AppendElement(clientOnWhite);
}
mFrontBuffer = Nothing();
}
}
void
-ContentClientDoubleBuffered::Updated(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy)
-{
- ContentClientRemoteBuffer::Updated(aRegionToDraw, aVisibleRegion, aDidSelfCopy);
-}
-
-void
ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
{
mFrontUpdatedRegion = aFrontUpdatedRegion;
RefPtr<TextureClient> newBack;
RefPtr<TextureClient> newBackOnWhite;
IntRect newBackBufferRect;
nsIntPoint newBackBufferRotation;
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -234,18 +234,17 @@ public:
* None of the underlying buffer attributes (rect, rotation)
* are affected by mapping/unmapping.
*/
virtual void BeginPaint() override;
virtual void BeginAsyncPaint() override;
virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr) override;
virtual void Updated(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy);
+ const nsIntRegion& aVisibleRegion);
// Expose these protected methods from the superclass.
virtual const gfx::IntRect& BufferRect() const
{
return RotatedContentBuffer::BufferRect();
}
virtual const nsIntPoint& BufferRotation() const
{
@@ -259,18 +258,17 @@ public:
{
return TextureFlags::IMMEDIATE_UPLOAD;
}
protected:
void DestroyBuffers();
virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy);
+ const nsIntRegion& aVisibleRegion);
void BuildTextureClients(gfx::SurfaceFormat aFormat,
const gfx::IntRect& aRect,
uint32_t aFlags);
void CreateBackBuffer(const gfx::IntRect& aBufferRect);
// Ensure we have a valid back buffer if we have a valid front buffer (i.e.
@@ -325,20 +323,16 @@ public:
virtual ~ContentClientDoubleBuffered() {}
virtual void Clear() override
{
ContentClientRemoteBuffer::Clear();
mFrontBuffer = Nothing();
}
- virtual void Updated(const nsIntRegion& aRegionToDraw,
- const nsIntRegion& aVisibleRegion,
- bool aDidSelfCopy) override;
-
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override;
virtual void BeginPaint() override;
virtual void BeginAsyncPaint() override;
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) override;
virtual void EnsureBackBufferIfFrontBuffer() override;