зеркало из https://github.com/mozilla/gecko-dev.git
Move DrawTo to RotatedBuffer. (bug 1409871 part 3, r=nical)
Similar to the previous patch, more functionality can be moved to rotated buffer and out of rotated content client. MozReview-Commit-ID: FNqfonyBBq9 --HG-- extra : rebase_source : cfc9c10d31baa48163107d0cf36c28a8ffda4ebb
This commit is contained in:
Родитель
359bb9b20b
Коммит
3e243339a6
|
@ -204,6 +204,39 @@ bool IsClippingCheap(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion)
|
||||||
aRegion.GetNumRects() <= 1;
|
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
|
void
|
||||||
RotatedBuffer::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
RotatedBuffer::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||||
const nsIntRegion& aUpdateRegion)
|
const nsIntRegion& aUpdateRegion)
|
||||||
|
@ -329,43 +362,6 @@ SourceRotatedBuffer::GetSourceSurface(ContextSource aSource) const
|
||||||
return surf.forget();
|
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
|
gfxContentType
|
||||||
RotatedContentBuffer::BufferContentType()
|
RotatedContentBuffer::BufferContentType()
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,6 +106,18 @@ public:
|
||||||
gfx::SourceSurface* aMask = nullptr,
|
gfx::SourceSurface* aMask = nullptr,
|
||||||
const gfx::Matrix* aMaskTransform = nullptr) const;
|
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,
|
void UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||||
const nsIntRegion& aUpdateRegion);
|
const nsIntRegion& aUpdateRegion);
|
||||||
|
|
||||||
|
@ -364,18 +376,6 @@ public:
|
||||||
|
|
||||||
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
|
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:
|
protected:
|
||||||
// new texture client versions
|
// new texture client versions
|
||||||
void SetBufferProvider(TextureClient* aClient)
|
void SetBufferProvider(TextureClient* aClient)
|
||||||
|
|
|
@ -118,6 +118,22 @@ ContentClientBasic::ContentClientBasic(gfx::BackendType aBackend)
|
||||||
, mBackend(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
|
void
|
||||||
ContentClientBasic::CreateBuffer(ContentType aType,
|
ContentClientBasic::CreateBuffer(ContentType aType,
|
||||||
const IntRect& aRect,
|
const IntRect& aRect,
|
||||||
|
|
|
@ -149,11 +149,7 @@ public:
|
||||||
float aOpacity,
|
float aOpacity,
|
||||||
gfx::CompositionOp aOp,
|
gfx::CompositionOp aOp,
|
||||||
gfx::SourceSurface* aMask,
|
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,
|
virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
|
||||||
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) override;
|
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) override;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче