Backed out changeset 6bc1a62eb443 (bug 947781) for build failures

This commit is contained in:
Ed Morley 2014-07-30 14:54:28 +01:00
parent fbefd28529
commit 3362e85a9e
3 changed files with 25 additions and 71 deletions

View File

@ -95,9 +95,6 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
MOZ_ASSERT(aSource != BUFFER_BOTH);
RefPtr<SourceSurface> snapshot = GetSourceSurface(aSource);
// direct2d is much slower when using OP_SOURCE so use OP_OVER and
// (maybe) a clear instead. Normally we need to draw in a single operation
// (to avoid flickering) but direct2d is ok since it defers rendering.
@ -105,11 +102,19 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
// cases.
if (aTarget->GetBackendType() == BackendType::DIRECT2D && aOperator == CompositionOp::OP_SOURCE) {
aOperator = CompositionOp::OP_OVER;
if (snapshot->GetFormat() == SurfaceFormat::B8G8R8A8) {
if (mDTBuffer->GetFormat() == SurfaceFormat::B8G8R8A8) {
aTarget->ClearRect(ToRect(fillRect));
}
}
RefPtr<gfx::SourceSurface> snapshot;
if (aSource == BUFFER_BLACK) {
snapshot = mDTBuffer->Snapshot();
} else {
MOZ_ASSERT(aSource == BUFFER_WHITE);
snapshot = mDTBufferOnWhite->Snapshot();
}
if (aOperator == CompositionOp::OP_SOURCE) {
// OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
// We also can't do a ClearRect+FillRect since we need the drawing to happen
@ -176,21 +181,6 @@ RotatedBuffer::DrawBufferWithRotation(gfx::DrawTarget *aTarget, ContextSource aS
DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aSource, aOpacity, aOperator,aMask, aMaskTransform);
}
TemporaryRef<SourceSurface>
SourceRotatedBuffer::GetSourceSurface(ContextSource aSource) const
{
RefPtr<SourceSurface> surf;
if (aSource == BUFFER_BLACK) {
surf = mSource;
} else {
MOZ_ASSERT(aSource == BUFFER_WHITE);
surf = mSourceOnWhite;
}
MOZ_ASSERT(surf);
return surf;
}
/* static */ bool
RotatedContentBuffer::IsClippingCheap(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
@ -747,19 +737,6 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState,
return result;
}
TemporaryRef<SourceSurface>
RotatedContentBuffer::GetSourceSurface(ContextSource aSource) const
{
MOZ_ASSERT(mDTBuffer);
if (aSource == BUFFER_BLACK) {
return mDTBuffer->Snapshot();
} else {
MOZ_ASSERT(mDTBufferOnWhite);
MOZ_ASSERT(aSource == BUFFER_WHITE);
return mDTBufferOnWhite->Snapshot();
}
}
}
}

View File

@ -52,9 +52,12 @@ class RotatedBuffer {
public:
typedef gfxContentType ContentType;
RotatedBuffer(const nsIntRect& aBufferRect,
RotatedBuffer(gfx::DrawTarget* aDTBuffer, gfx::DrawTarget* aDTBufferOnWhite,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
: mBufferRect(aBufferRect)
: mDTBuffer(aDTBuffer)
, mDTBufferOnWhite(aDTBufferOnWhite)
, mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
, mDidSelfCopy(false)
{ }
@ -86,10 +89,8 @@ public:
const nsIntRect& BufferRect() const { return mBufferRect; }
const nsIntPoint& BufferRotation() const { return mBufferRotation; }
virtual bool HaveBuffer() const = 0;
virtual bool HaveBufferOnWhite() const = 0;
virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const = 0;
virtual bool HaveBuffer() const { return mDTBuffer; }
virtual bool HaveBufferOnWhite() const { return mDTBufferOnWhite; }
protected:
@ -115,6 +116,8 @@ protected:
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform) const;
RefPtr<gfx::DrawTarget> mDTBuffer;
RefPtr<gfx::DrawTarget> mDTBufferOnWhite;
/** The area of the ThebesLayer that is covered by the buffer as a whole */
nsIntRect mBufferRect;
/**
@ -133,27 +136,6 @@ protected:
bool mDidSelfCopy;
};
class SourceRotatedBuffer : public RotatedBuffer
{
public:
SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
: RotatedBuffer(aBufferRect, aBufferRotation)
, mSource(aSource)
, mSourceOnWhite(aSourceOnWhite)
{ }
virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
virtual bool HaveBuffer() const { return !!mSource; }
virtual bool HaveBufferOnWhite() const { return !!mSourceOnWhite; }
private:
RefPtr<gfx::SourceSurface> mSource;
RefPtr<gfx::SourceSurface> mSourceOnWhite;
};
// Mixin class for classes which need logic for loaning out a draw target.
// See comments on BorrowDrawTargetForQuadrantUpdate.
class BorrowDrawTarget
@ -326,8 +308,6 @@ public:
gfx::DrawTarget* GetDTBuffer() { return mDTBuffer; }
gfx::DrawTarget* GetDTBufferOnWhite() { return mDTBufferOnWhite; }
virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
/**
* Complete the drawing operation. The region to draw must have been
* drawn before this is called. The contents of the buffer are drawn
@ -418,9 +398,6 @@ protected:
*/
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) {}
RefPtr<gfx::DrawTarget> mDTBuffer;
RefPtr<gfx::DrawTarget> mDTBufferOnWhite;
/**
* These members are only set transiently. They're used to map mDTBuffer
* when we're using surfaces that require explicit map/unmap. Only one

View File

@ -486,14 +486,14 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
// Restrict the DrawTargets and frontBuffer to a scope to make
// sure there is no more external references to the DrawTargets
// when we Unlock the TextureClients.
RefPtr<SourceSurface> surf = mFrontClient->BorrowDrawTarget()->Snapshot();
RefPtr<SourceSurface> surfOnWhite = mFrontClientOnWhite
? mFrontClientOnWhite->BorrowDrawTarget()->Snapshot()
RefPtr<DrawTarget> dt = mFrontClient->BorrowDrawTarget();
RefPtr<DrawTarget> dtOnWhite = mFrontClientOnWhite
? mFrontClientOnWhite->BorrowDrawTarget()
: nullptr;
SourceRotatedBuffer frontBuffer(surf,
surfOnWhite,
mFrontBufferRect,
mFrontBufferRotation);
RotatedBuffer frontBuffer(dt,
dtOnWhite,
mFrontBufferRect,
mFrontBufferRotation);
UpdateDestinationFrom(frontBuffer, updateRegion);
}