Clean up some methods on ContentClient (bug 1409871 part 17, r=nical)

This commit does some more cleanup on the content client class hierarchy.
Some methods were virtual or instance methods when they didn't need to be.

MozReview-Commit-ID: 2y2D3zYtYvM
This commit is contained in:
Ryan Hunt
2017-10-18 14:54:26 -04:00
parent 506f8e4a2e
commit f6ac493ed4
4 changed files with 46 additions and 67 deletions

View File

@@ -256,6 +256,27 @@ ContentClient::BorrowDrawTargetForPainting(ContentClient::PaintState& aPaintStat
return capturedState->mTargetDual;
}
nsIntRegion
ExpandDrawRegion(ContentClient::PaintState& aPaintState,
RotatedBuffer::DrawIterator* aIter,
BackendType aBackendType)
{
nsIntRegion* drawPtr = &aPaintState.mRegionToDraw;
if (aIter) {
// The iterators draw region currently only contains the bounds of the region,
// this makes it the precise region.
aIter->mDrawRegion.And(aIter->mDrawRegion, aPaintState.mRegionToDraw);
drawPtr = &aIter->mDrawRegion;
}
if (aBackendType == BackendType::DIRECT2D ||
aBackendType == BackendType::DIRECT2D1_1) {
// Simplify the draw region to avoid hitting expensive drawing paths
// for complex regions.
drawPtr->SimplifyOutwardByArea(100 * 100);
}
return *drawPtr;
}
RefPtr<CapturedPaintState>
ContentClient::BorrowDrawTargetForRecording(ContentClient::PaintState& aPaintState,
RotatedBuffer::DrawIterator* aIter,
@@ -290,32 +311,11 @@ ContentClient::BorrowDrawTargetForRecording(ContentClient::PaintState& aPaintSta
}
void
ContentClient::ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned)
ContentClient::ReturnDrawTarget(gfx::DrawTarget*& aReturned)
{
mBuffer->ReturnDrawTarget(aReturned);
}
nsIntRegion
ContentClient::ExpandDrawRegion(ContentClient::PaintState& aPaintState,
RotatedBuffer::DrawIterator* aIter,
BackendType aBackendType)
{
nsIntRegion* drawPtr = &aPaintState.mRegionToDraw;
if (aIter) {
// The iterators draw region currently only contains the bounds of the region,
// this makes it the precise region.
aIter->mDrawRegion.And(aIter->mDrawRegion, aPaintState.mRegionToDraw);
drawPtr = &aIter->mDrawRegion;
}
if (aBackendType == BackendType::DIRECT2D ||
aBackendType == BackendType::DIRECT2D1_1) {
// Simplify the draw region to avoid hitting expensive drawing paths
// for complex regions.
drawPtr->SimplifyOutwardByArea(100 * 100);
}
return *drawPtr;
}
/*static */ bool
ContentClient::PrepareDrawTargetForPainting(CapturedPaintState* aState)
{
@@ -630,19 +630,6 @@ private:
nsIntPoint mBufferRotation;
};
void
ContentClientRemoteBuffer::BeginPaint()
{
EnsureBackBufferIfFrontBuffer();
}
void
ContentClientRemoteBuffer::BeginAsyncPaint()
{
BeginPaint();
mInAsyncPaint = true;
}
void
ContentClientRemoteBuffer::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
{
@@ -834,6 +821,13 @@ ContentClientDoubleBuffered::Dump(std::stringstream& aStream,
aCompress);
}
void
ContentClientDoubleBuffered::Clear()
{
ContentClient::Clear();
mFrontBuffer = nullptr;
}
void
ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
{
@@ -853,7 +847,7 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
void
ContentClientDoubleBuffered::BeginPaint()
{
ContentClientRemoteBuffer::BeginPaint();
EnsureBackBufferIfFrontBuffer();
mIsNewBuffer = false;