Fix PrepareDrawTargetForPainting (bug 1409871 part 16, r=dvander)

CapturedPaintState::mTarget is actually a dual draw target to the black and
white draw targets, so this code will have the white draw target cleared black
and then white. This isn't incorrect, it's just wasteful.

MozReview-Commit-ID: ItgiSmegPK6

--HG--
extra : rebase_source : 9c3c88f463087a75383f1940ddeef6bb68ec35c4
This commit is contained in:
Ryan Hunt 2017-10-18 14:46:54 -04:00
parent eba630e380
commit 7f1dd327e3
4 changed files with 8 additions and 4 deletions

View File

@ -30,7 +30,7 @@ struct MOZ_STACK_CLASS AutoCapturedPaintSetup
{
AutoCapturedPaintSetup(CapturedPaintState* aState, CompositorBridgeChild* aBridge)
: mState(aState)
, mTarget(aState->mTarget)
, mTarget(aState->mTargetDual)
, mRestorePermitsSubpixelAA(mTarget->GetPermitSubpixelAA())
, mOldTransform(mTarget->GetTransform())
, mBridge(aBridge)
@ -186,7 +186,7 @@ PaintThread::AsyncPaintContents(CompositorBridgeChild* aBridge,
MOZ_ASSERT(IsOnPaintThread());
MOZ_ASSERT(aState);
DrawTarget* target = aState->mTarget;
DrawTarget* target = aState->mTargetDual;
DrawTargetCapture* capture = aState->mCapture;
AutoCapturedPaintSetup setup(aState, aBridge);

View File

@ -28,12 +28,14 @@ class CapturedPaintState {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CapturedPaintState)
public:
CapturedPaintState(nsIntRegion& aRegionToDraw,
gfx::DrawTarget* aTargetDual,
gfx::DrawTarget* aTarget,
gfx::DrawTarget* aTargetOnWhite,
const gfx::Matrix& aTargetTransform,
SurfaceMode aSurfaceMode,
gfxContentType aContentType)
: mRegionToDraw(aRegionToDraw)
, mTargetDual(aTargetDual)
, mTarget(aTarget)
, mTargetOnWhite(aTargetOnWhite)
, mTargetTransform(aTargetTransform)
@ -45,6 +47,7 @@ public:
RefPtr<TextureClient> mTextureClient;
RefPtr<TextureClient> mTextureClientOnWhite;
RefPtr<gfx::DrawTargetCapture> mCapture;
RefPtr<gfx::DrawTarget> mTargetDual;
RefPtr<gfx::DrawTarget> mTarget;
RefPtr<gfx::DrawTarget> mTargetOnWhite;
gfx::Matrix mTargetTransform;

View File

@ -224,7 +224,7 @@ ClientPaintedLayer::PaintOffMainThread()
while (RefPtr<CapturedPaintState> captureState =
mContentClient->BorrowDrawTargetForRecording(state, &iter))
{
DrawTarget* target = captureState->mTarget;
DrawTarget* target = captureState->mTargetDual;
if (!target || !target->IsValid()) {
if (target) {
mContentClient->ReturnDrawTargetToBuffer(target);

View File

@ -253,7 +253,7 @@ ContentClient::BorrowDrawTargetForPainting(ContentClient::PaintState& aPaintStat
return nullptr;
}
return capturedState->mTarget;
return capturedState->mTargetDual;
}
RefPtr<CapturedPaintState>
@ -282,6 +282,7 @@ ContentClient::BorrowDrawTargetForRecording(ContentClient::PaintState& aPaintSta
RefPtr<CapturedPaintState> state =
new CapturedPaintState(regionToDraw,
result,
mBuffer->GetDTBuffer(),
mBuffer->GetDTBufferOnWhite(),
transform,
aPaintState.mMode,