Backed out changeset a9f8832adcb4 (bug 1409871)

This commit is contained in:
Sebastian Hengst 2017-10-23 23:44:04 +02:00
Родитель 1bf364d760
Коммит 66bc17f938
4 изменённых файлов: 54 добавлений и 62 удалений

Просмотреть файл

@ -204,39 +204,6 @@ bool IsClippingCheap(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion)
aRegion.GetNumRects() <= 1;
}
void
RotatedBuffer::DrawTo(PaintedLayer* aLayer,
DrawTarget* aTarget,
float aOpacity,
CompositionOp aOp,
SourceSurface* aMask,
const Matrix* aMaskTransform)
{
bool clipped = false;
// If the entire buffer is valid, we can just draw the whole thing,
// no need to clip. But we'll still clip if clipping is cheap ---
// that might let us copy a smaller region of the buffer.
// Also clip to the visible region if we're told to.
if (!aLayer->GetValidRegion().Contains(BufferRect()) ||
(ToData(aLayer)->GetClipToVisibleRegion() &&
!aLayer->GetVisibleRegion().ToUnknownRegion().Contains(BufferRect())) ||
IsClippingCheap(aTarget, aLayer->GetLocalVisibleRegion().ToUnknownRegion())) {
// We don't want to draw invalid stuff, so we need to clip. Might as
// well clip to the smallest area possible --- the visible region.
// Bug 599189 if there is a non-integer-translation transform in aTarget,
// we might sample pixels outside GetLocalVisibleRegion(), which is wrong
// and may cause gray lines.
gfxUtils::ClipToRegion(aTarget, aLayer->GetLocalVisibleRegion().ToUnknownRegion());
clipped = true;
}
DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aOp, aMask, aMaskTransform);
if (clipped) {
aTarget->PopClip();
}
}
void
RotatedBuffer::UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion)
@ -362,6 +329,43 @@ SourceRotatedBuffer::GetSourceSurface(ContextSource aSource) const
return surf.forget();
}
void
RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
DrawTarget* aTarget,
float aOpacity,
CompositionOp aOp,
SourceSurface* aMask,
const Matrix* aMaskTransform)
{
if (!EnsureBuffer()) {
return;
}
bool clipped = false;
// If the entire buffer is valid, we can just draw the whole thing,
// no need to clip. But we'll still clip if clipping is cheap ---
// that might let us copy a smaller region of the buffer.
// Also clip to the visible region if we're told to.
if (!aLayer->GetValidRegion().Contains(BufferRect()) ||
(ToData(aLayer)->GetClipToVisibleRegion() &&
!aLayer->GetVisibleRegion().ToUnknownRegion().Contains(BufferRect())) ||
IsClippingCheap(aTarget, aLayer->GetLocalVisibleRegion().ToUnknownRegion())) {
// We don't want to draw invalid stuff, so we need to clip. Might as
// well clip to the smallest area possible --- the visible region.
// Bug 599189 if there is a non-integer-translation transform in aTarget,
// we might sample pixels outside GetLocalVisibleRegion(), which is wrong
// and may cause gray lines.
gfxUtils::ClipToRegion(aTarget, aLayer->GetLocalVisibleRegion().ToUnknownRegion());
clipped = true;
}
DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aOp, aMask, aMaskTransform);
if (clipped) {
aTarget->PopClip();
}
}
gfxContentType
RotatedContentBuffer::BufferContentType()
{

Просмотреть файл

@ -106,18 +106,6 @@ public:
gfx::SourceSurface* aMask = nullptr,
const gfx::Matrix* aMaskTransform = nullptr) const;
/**
* Complete the drawing operation. The region to draw must have been
* drawn before this is called. The contents of the buffer are drawn
* to aTarget.
*/
void DrawTo(PaintedLayer* aLayer,
gfx::DrawTarget* aTarget,
float aOpacity,
gfx::CompositionOp aOp,
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform);
void UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion);
@ -376,6 +364,18 @@ public:
virtual already_AddRefed<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
* to aTarget.
*/
void DrawTo(PaintedLayer* aLayer,
gfx::DrawTarget* aTarget,
float aOpacity,
gfx::CompositionOp aOp,
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform);
protected:
// new texture client versions
void SetBufferProvider(TextureClient* aClient)

Просмотреть файл

@ -118,22 +118,6 @@ ContentClientBasic::ContentClientBasic(gfx::BackendType aBackend)
, mBackend(aBackend)
{}
void
ContentClientBasic::DrawTo(PaintedLayer* aLayer,
gfx::DrawTarget* aTarget,
float aOpacity,
gfx::CompositionOp aOp,
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform)
{
if (!EnsureBuffer()) {
return;
}
RotatedContentBuffer::DrawTo(aLayer, aTarget, aOpacity, aOp,
aMask, aMaskTransform);
}
void
ContentClientBasic::CreateBuffer(ContentType aType,
const IntRect& aRect,

Просмотреть файл

@ -149,7 +149,11 @@ public:
float aOpacity,
gfx::CompositionOp aOp,
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform);
const gfx::Matrix* aMaskTransform)
{
RotatedContentBuffer::DrawTo(aLayer, aTarget, aOpacity, aOp,
aMask, aMaskTransform);
}
virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) override;