зеркало из https://github.com/mozilla/gecko-dev.git
Remove BeginPaintBuffer (bug 1409871 part 18, r=nical)
Now that BeginPaintBuffer and BeginPaint are both implemented by content client, I think it makes sense to just merge them into one method. This simplifies the interface clients have to use. MozReview-Commit-ID: 8bjH6WcpZS9 --HG-- extra : rebase_source : c2aad6cd9d85f7dd09652ee253683f03825e95c6
This commit is contained in:
Родитель
23a0d9c85e
Коммит
04ee50acb9
|
@ -162,7 +162,7 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
|
|||
flags |= ContentClient::PAINT_NO_ROTATION;
|
||||
}
|
||||
PaintState state =
|
||||
mContentClient->BeginPaintBuffer(this, flags);
|
||||
mContentClient->BeginPaint(this, flags);
|
||||
SubtractFromValidRegion(state.mRegionToInvalidate);
|
||||
|
||||
DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(state);
|
||||
|
|
|
@ -138,11 +138,9 @@ ClientPaintedLayer::PaintThebes(nsTArray<ReadbackProcessor::Update>* aReadbackUp
|
|||
NS_ASSERTION(ClientManager()->InDrawing(),
|
||||
"Can only draw in drawing phase");
|
||||
|
||||
mContentClient->BeginPaint();
|
||||
|
||||
uint32_t flags = GetPaintFlags();
|
||||
|
||||
PaintState state = mContentClient->BeginPaintBuffer(this, flags);
|
||||
PaintState state = mContentClient->BeginPaint(this, flags);
|
||||
if (!UpdatePaintRegion(state)) {
|
||||
return;
|
||||
}
|
||||
|
@ -208,11 +206,9 @@ ClientPaintedLayer::PaintThebes(nsTArray<ReadbackProcessor::Update>* aReadbackUp
|
|||
bool
|
||||
ClientPaintedLayer::PaintOffMainThread()
|
||||
{
|
||||
mContentClient->BeginAsyncPaint();
|
||||
|
||||
uint32_t flags = GetPaintFlags();
|
||||
|
||||
PaintState state = mContentClient->BeginPaintBuffer(this, flags);
|
||||
PaintState state = mContentClient->BeginPaint(this, flags | ContentClient::PAINT_ASYNC);
|
||||
if (!UpdatePaintRegion(state)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -111,9 +111,13 @@ ContentClient::Clear()
|
|||
}
|
||||
|
||||
ContentClient::PaintState
|
||||
ContentClient::BeginPaintBuffer(PaintedLayer* aLayer,
|
||||
uint32_t aFlags)
|
||||
ContentClient::BeginPaint(PaintedLayer* aLayer,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
if (aFlags & PAINT_ASYNC) {
|
||||
mInAsyncPaint = true;
|
||||
}
|
||||
|
||||
PaintState result;
|
||||
|
||||
BufferDecision dest = CalculateBufferForPaint(aLayer, aFlags);
|
||||
|
@ -476,12 +480,6 @@ ContentClient::LockMode() const
|
|||
: OpenMode::OPEN_READ_WRITE;
|
||||
}
|
||||
|
||||
void
|
||||
ContentClient::BeginAsyncPaint()
|
||||
{
|
||||
mInAsyncPaint = true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentClient::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
|
||||
{
|
||||
|
@ -845,43 +843,36 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
|||
mFrontAndBackBufferDiffer = true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientDoubleBuffered::BeginPaint()
|
||||
ContentClient::PaintState
|
||||
ContentClientDoubleBuffered::BeginPaint(PaintedLayer* aLayer,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
EnsureBackBufferIfFrontBuffer();
|
||||
|
||||
mIsNewBuffer = false;
|
||||
|
||||
if (!mFrontAndBackBufferDiffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mFrontBuffer || !mBuffer) {
|
||||
mFrontAndBackBufferDiffer = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFrontBuffer->DidSelfCopy()) {
|
||||
// We can't easily draw our front buffer into us, since we're going to be
|
||||
// copying stuff around anyway it's easiest if we just move our situation
|
||||
// to non-rotated while we're at it. If this situation occurs we'll have
|
||||
// hit a self-copy path in PaintThebes before as well anyway.
|
||||
gfx::IntRect backBufferRect = mBuffer->BufferRect();
|
||||
backBufferRect.MoveTo(mFrontBuffer->BufferRect().TopLeft());
|
||||
if (mFrontAndBackBufferDiffer) {
|
||||
if (mFrontBuffer->DidSelfCopy()) {
|
||||
// We can't easily draw our front buffer into us, since we're going to be
|
||||
// copying stuff around anyway it's easiest if we just move our situation
|
||||
// to non-rotated while we're at it. If this situation occurs we'll have
|
||||
// hit a self-copy path in PaintThebes before as well anyway.
|
||||
gfx::IntRect backBufferRect = mBuffer->BufferRect();
|
||||
backBufferRect.MoveTo(mFrontBuffer->BufferRect().TopLeft());
|
||||
|
||||
mBuffer->SetBufferRect(backBufferRect);
|
||||
mBuffer->SetBufferRotation(IntPoint(0,0));
|
||||
return;
|
||||
mBuffer->SetBufferRect(backBufferRect);
|
||||
mBuffer->SetBufferRotation(IntPoint(0,0));
|
||||
} else {
|
||||
mBuffer->SetBufferRect(mFrontBuffer->BufferRect());
|
||||
mBuffer->SetBufferRotation(mFrontBuffer->BufferRotation());
|
||||
}
|
||||
}
|
||||
mBuffer->SetBufferRect(mFrontBuffer->BufferRect());
|
||||
mBuffer->SetBufferRotation(mFrontBuffer->BufferRotation());
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientDoubleBuffered::BeginAsyncPaint()
|
||||
{
|
||||
BeginPaint();
|
||||
mInAsyncPaint = true;
|
||||
return ContentClient::BeginPaint(aLayer, aFlags);
|
||||
}
|
||||
|
||||
// Sync front/back buffers content
|
||||
|
|
|
@ -119,7 +119,8 @@ public:
|
|||
enum {
|
||||
PAINT_WILL_RESAMPLE = 0x01,
|
||||
PAINT_NO_ROTATION = 0x02,
|
||||
PAINT_CAN_DRAW_ROTATED = 0x04
|
||||
PAINT_CAN_DRAW_ROTATED = 0x04,
|
||||
PAINT_ASYNC = 0x08,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -142,7 +143,8 @@ public:
|
|||
* will need to call BorrowDrawTargetForPainting multiple times to achieve
|
||||
* this.
|
||||
*/
|
||||
PaintState BeginPaintBuffer(PaintedLayer* aLayer, uint32_t aFlags);
|
||||
virtual PaintState BeginPaint(PaintedLayer* aLayer, uint32_t aFlags);
|
||||
virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr);
|
||||
|
||||
/**
|
||||
* Fetch a DrawTarget for rendering. The DrawTarget remains owned by
|
||||
|
@ -175,11 +177,6 @@ public:
|
|||
|
||||
void ReturnDrawTarget(gfx::DrawTarget*& aReturned);
|
||||
|
||||
// Call before and after painting into this content client
|
||||
virtual void BeginPaint() {}
|
||||
virtual void BeginAsyncPaint();
|
||||
virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr);
|
||||
|
||||
static bool PrepareDrawTargetForPainting(CapturedPaintState*);
|
||||
|
||||
enum {
|
||||
|
@ -371,8 +368,7 @@ public:
|
|||
|
||||
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override;
|
||||
|
||||
virtual void BeginPaint() override;
|
||||
virtual void BeginAsyncPaint() override;
|
||||
virtual PaintState BeginPaint(PaintedLayer* aLayer, uint32_t aFlags) override;
|
||||
|
||||
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче