mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 948221 - Part 4: Add a gfxSurfaceDrawable constructor that takes a SourceSurface. r=roc
This commit is contained in:
parent
6133167fe4
commit
0cfc75c3ec
@ -33,6 +33,15 @@ gfxSurfaceDrawable::gfxSurfaceDrawable(DrawTarget* aDrawTarget,
|
||||
{
|
||||
}
|
||||
|
||||
gfxSurfaceDrawable::gfxSurfaceDrawable(SourceSurface* aSurface,
|
||||
const gfxIntSize aSize,
|
||||
const gfxMatrix aTransform)
|
||||
: gfxDrawable(aSize)
|
||||
, mSourceSurface(aSurface)
|
||||
, mTransform(aTransform)
|
||||
{
|
||||
}
|
||||
|
||||
static gfxMatrix
|
||||
DeviceToImageTransform(gfxContext* aContext,
|
||||
const gfxMatrix& aUserSpaceToImageSpace)
|
||||
@ -127,6 +136,8 @@ gfxSurfaceDrawable::Draw(gfxContext* aContext,
|
||||
RefPtr<SourceSurface> source = mDrawTarget->Snapshot();
|
||||
pattern = new gfxPattern(source, Matrix());
|
||||
}
|
||||
} else if (mSourceSurface) {
|
||||
pattern = new gfxPattern(mSourceSurface, Matrix());
|
||||
} else {
|
||||
pattern = new gfxPattern(mSurface);
|
||||
}
|
||||
@ -160,7 +171,7 @@ gfxSurfaceDrawable::Draw(gfxContext* aContext,
|
||||
already_AddRefed<gfxImageSurface>
|
||||
gfxSurfaceDrawable::GetAsImageSurface()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
if (mDrawTarget || mSourceSurface) {
|
||||
// TODO: Find a way to implement this. The caller really wants a 'sub-image' of
|
||||
// the original, without having to do a copy. GetDataSurface() might just copy,
|
||||
// which isn't useful.
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
const gfxMatrix aTransform = gfxMatrix());
|
||||
gfxSurfaceDrawable(mozilla::gfx::DrawTarget* aDT, const gfxIntSize aSize,
|
||||
const gfxMatrix aTransform = gfxMatrix());
|
||||
gfxSurfaceDrawable(mozilla::gfx::SourceSurface* aSurface, const gfxIntSize aSize,
|
||||
const gfxMatrix aTransform = gfxMatrix());
|
||||
virtual ~gfxSurfaceDrawable() {}
|
||||
|
||||
virtual bool Draw(gfxContext* aContext,
|
||||
@ -71,6 +73,7 @@ public:
|
||||
protected:
|
||||
nsRefPtr<gfxASurface> mSurface;
|
||||
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
|
||||
mozilla::RefPtr<mozilla::gfx::SourceSurface> mSourceSurface;
|
||||
const gfxMatrix mTransform;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user