mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1522021. Implement SourceSurfaceOffset. r=mstange
This forwards to an underlying source surface but also has an origin that it uses to correctly return results from GetRect() Differential Revision: https://phabricator.services.mozilla.com/D17692 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b0d9cc5e6d
commit
93752e905d
@ -25,7 +25,7 @@ bool DrawTargetOffset::Init(DrawTarget* aDrawTarget, IntPoint aOrigin) {
|
||||
}
|
||||
|
||||
already_AddRefed<SourceSurface> DrawTargetOffset::Snapshot() {
|
||||
return mDrawTarget->Snapshot();
|
||||
return MakeAndAddRef<SourceSurfaceOffset>(mDrawTarget->Snapshot(), mOrigin);
|
||||
}
|
||||
|
||||
void DrawTargetOffset::DetachAllSnapshots() {}
|
||||
|
@ -19,6 +19,21 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
class SourceSurfaceOffset: public SourceSurface {
|
||||
public:
|
||||
SourceSurfaceOffset(RefPtr<SourceSurface> aSurface, IntPoint aOffset) :
|
||||
mSurface(aSurface),
|
||||
mOffset(aOffset) {}
|
||||
virtual SurfaceType GetType() const override { return SurfaceType::OFFSET; }
|
||||
virtual IntSize GetSize() const override { return mSurface->GetSize(); }
|
||||
virtual IntRect GetRect() const override { return IntRect(mOffset, mSurface->GetSize()); }
|
||||
virtual SurfaceFormat GetFormat() const override { return mSurface->GetFormat(); }
|
||||
virtual already_AddRefed<DataSourceSurface> GetDataSurface() override { return mSurface->GetDataSurface(); }
|
||||
private:
|
||||
RefPtr<SourceSurface> mSurface;
|
||||
IntPoint mOffset;
|
||||
};
|
||||
|
||||
class DrawTargetOffset : public DrawTarget {
|
||||
public:
|
||||
DrawTargetOffset();
|
||||
|
@ -34,7 +34,8 @@ enum class SurfaceType : int8_t {
|
||||
TILED, /* Surface from a tiled DrawTarget */
|
||||
DATA_SHARED, /* Data surface using shared memory */
|
||||
CAPTURE, /* Data from a DrawTargetCapture */
|
||||
DATA_RECYCLING_SHARED /* Data surface using shared memory */
|
||||
DATA_RECYCLING_SHARED, /* Data surface using shared memory */
|
||||
OFFSET, /* Offset */
|
||||
};
|
||||
|
||||
enum class SurfaceFormat : int8_t {
|
||||
|
Loading…
Reference in New Issue
Block a user