Backed out changeset c57db572271d (bug 1409871)

This commit is contained in:
Sebastian Hengst 2017-10-23 23:43:02 +02:00
Родитель 12e38cbd80
Коммит 5609b36c6c
1 изменённых файлов: 69 добавлений и 98 удалений

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

@ -81,6 +81,18 @@ public:
: mDidSelfCopy(false)
{ }
struct DrawIterator {
friend class RotatedBuffer;
DrawIterator()
: mCount(0)
{}
nsIntRegion mDrawRegion;
private:
uint32_t mCount;
};
/*
* Which buffer should be drawn to/read from.
*/
@ -89,12 +101,8 @@ public:
BUFFER_WHITE, // The buffer with white background, only valid with component alpha.
BUFFER_BOTH // The combined black/white buffers, only valid for writing operations, not reading.
};
/**
* Draws the contents of this rotated buffer into the specified draw target.
* It is the callers repsonsibility to ensure aTarget is flushed after calling
* this method.
*/
// It is the callers repsonsibility to ensure aTarget is flushed after calling
// this method.
void DrawBufferWithRotation(gfx::DrawTarget* aTarget, ContextSource aSource,
float aOpacity = 1.0,
gfx::CompositionOp aOperator = gfx::CompositionOp::OP_OVER,
@ -113,28 +121,47 @@ public:
gfx::SourceSurface* aMask,
const gfx::Matrix* aMaskTransform);
/**
* Update the specified region of this rotated buffer with the contents
* of a source rotated buffer.
*/
void UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion);
/**
* A draw iterator is used to keep track of which quadrant of a rotated
* buffer and region of that quadrant is being updated.
* Adjusts the buffer to be centered on the destination buffer rect,
* and ready to draw the specified bounds. Returns whether a new buffer
* needs to be created.
*/
struct DrawIterator {
friend class RotatedBuffer;
DrawIterator()
: mCount(0)
{}
bool AdjustTo(const gfx::IntRect& aDestBufferRect,
const gfx::IntRect& aDrawBounds,
bool aCanHaveRotation,
bool aCanDrawRotated);
nsIntRegion mDrawRegion;
/**
* |BufferRect()| is the rect of device pixels that this
* RotatedBuffer covers. That is what DrawBufferWithRotation()
* will paint when it's called.
*/
const gfx::IntRect& BufferRect() const { return mBufferRect; }
const gfx::IntPoint& BufferRotation() const { return mBufferRotation; }
private:
uint32_t mCount;
};
void SetBufferRect(const gfx::IntRect& aBufferRect) {
mBufferRect = aBufferRect;
}
void SetBufferRotation(const gfx::IntPoint& aBufferRotation) {
mBufferRotation = aBufferRotation;
}
bool DidSelfCopy() const { return mDidSelfCopy; }
void ClearDidSelfCopy() { mDidSelfCopy = false; }
virtual gfx::SurfaceFormat GetFormat() const = 0;
virtual bool HaveBuffer() const = 0;
virtual bool HaveBufferOnWhite() const = 0;
virtual bool IsLocked() = 0;
virtual bool Lock(OpenMode aMode) = 0;
virtual void Unlock() = 0;
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const = 0;
/**
* Get a draw target at the specified resolution for updating |aBounds|,
@ -157,63 +184,6 @@ public:
bool aSetTransform = true,
gfx::Matrix* aOutTransform = nullptr);
/**
* Adjusts the buffer to be centered on the destination buffer rect,
* and ready to draw the specified bounds. Returns whether a new buffer
* needs to be created.
*/
bool AdjustTo(const gfx::IntRect& aDestBufferRect,
const gfx::IntRect& aDrawBounds,
bool aCanHaveRotation,
bool aCanDrawRotated);
/**
* |BufferRect()| is the rect of device pixels that this
* RotatedBuffer covers. That is what DrawBufferWithRotation()
* will paint when it's called.
*/
const gfx::IntRect& BufferRect() const { return mBufferRect; }
const gfx::IntPoint& BufferRotation() const { return mBufferRotation; }
/**
* Overrides the current buffer rect with the specified rect.
* Do not do this unless you know what you're doing.
*/
void SetBufferRect(const gfx::IntRect& aBufferRect) {
mBufferRect = aBufferRect;
}
/**
* Overrides the current buffer rotation with the specified point.
* Do not do this unless you know what you're doing.
*/
void SetBufferRotation(const gfx::IntPoint& aBufferRotation) {
mBufferRotation = aBufferRotation;
}
/**
* Returns whether this buffer did a self copy when adjusting to
* a new buffer rect. This is only used externally for syncing
* rotated buffers.
*/
bool DidSelfCopy() const { return mDidSelfCopy; }
/**
* Clears the self copy flag.
*/
void ClearDidSelfCopy() { mDidSelfCopy = false; }
virtual bool IsLocked() = 0;
virtual bool Lock(OpenMode aMode) = 0;
virtual void Unlock() = 0;
virtual bool HaveBuffer() const = 0;
virtual bool HaveBufferOnWhite() const = 0;
virtual gfx::SurfaceFormat GetFormat() const = 0;
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const = 0;
virtual gfx::DrawTarget* GetDTBuffer() const = 0;
virtual gfx::DrawTarget* GetDTBufferOnWhite() const = 0;
@ -243,7 +213,7 @@ protected:
const gfx::Matrix* aMaskTransform) const;
/** The area of the PaintedLayer that is covered by the buffer as a whole */
gfx::IntRect mBufferRect;
gfx::IntRect mBufferRect;
/**
* The x and y rotation of the buffer. Conceptually the buffer
* has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
@ -254,12 +224,10 @@ protected:
* where items falling off the end of the buffer are returned to the
* buffer at the other end, not 2D rotation!
*/
gfx::IntPoint mBufferRotation;
/**
* When this is true it means that all pixels have moved inside the buffer.
* It's not possible to sync with another buffer without a full copy.
*/
bool mDidSelfCopy;
gfx::IntPoint mBufferRotation;
// When this is true it means that all pixels have moved inside the buffer.
// It's not possible to sync with another buffer without a full copy.
bool mDidSelfCopy;
};
class RemoteRotatedBuffer : public RotatedBuffer
@ -277,21 +245,22 @@ public:
virtual bool Lock(OpenMode aMode) override;
virtual void Unlock() override;
virtual bool HaveBuffer() const override { return !!mClient; }
virtual bool HaveBufferOnWhite() const override { return !!mClientOnWhite; }
virtual gfx::SurfaceFormat GetFormat() const override;
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const override;
virtual gfx::DrawTarget* GetDTBuffer() const override;
virtual gfx::DrawTarget* GetDTBufferOnWhite() const override;
void SyncWithObject(SyncObjectClient* aSyncObject);
void Clear();
TextureClient* GetClient() const { return mClient; }
TextureClient* GetClientOnWhite() const { return mClientOnWhite; }
void SyncWithObject(SyncObjectClient* aSyncObject);
void Clear();
virtual gfx::SurfaceFormat GetFormat() const override;
virtual bool HaveBuffer() const override { return !!mClient; }
virtual bool HaveBufferOnWhite() const override { return !!mClientOnWhite; }
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const override;
protected:
virtual gfx::DrawTarget* GetDTBuffer() const override;
virtual gfx::DrawTarget* GetDTBufferOnWhite() const override;
private:
RefPtr<TextureClient> mClient;
@ -316,13 +285,14 @@ public:
virtual bool Lock(OpenMode aMode) override { return true; }
virtual void Unlock() override {}
virtual gfx::SurfaceFormat GetFormat() const override;
virtual bool HaveBuffer() const override { return !!mTarget; }
virtual bool HaveBufferOnWhite() const override { return !!mTargetOnWhite; }
virtual gfx::SurfaceFormat GetFormat() const override;
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const override;
protected:
virtual gfx::DrawTarget* GetDTBuffer() const override;
virtual gfx::DrawTarget* GetDTBufferOnWhite() const override;
@ -353,6 +323,7 @@ public:
virtual bool HaveBuffer() const { return !!mSource; }
virtual bool HaveBufferOnWhite() const { return !!mSourceOnWhite; }
protected:
virtual gfx::DrawTarget* GetDTBuffer() const { return nullptr; }
virtual gfx::DrawTarget* GetDTBufferOnWhite() const { return nullptr; }