mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 575521 - Add gfxQuartzSurface::GetAsImageSurface. r=jrmuizel,vlad
This commit is contained in:
parent
69ac8b8909
commit
c001466571
@ -117,6 +117,23 @@ PRInt32 gfxQuartzSurface::GetDefaultContextFlags() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface> gfxQuartzSurface::GetAsImageSurface()
|
||||
{
|
||||
cairo_surface_t *surface = cairo_quartz_surface_get_image(mSurface);
|
||||
if (!surface)
|
||||
return nsnull;
|
||||
|
||||
nsRefPtr<gfxASurface> img = Wrap(surface);
|
||||
|
||||
// cairo_quartz_surface_get_image returns a referenced image, and thebes
|
||||
// shares the refcounts of Cairo surfaces. However, Wrap also adds a
|
||||
// reference to the image. We need to remove one of these references
|
||||
// explicitly so we don't leak.
|
||||
img->Release();
|
||||
|
||||
return static_cast<gfxImageSurface*>(img.forget().get());
|
||||
}
|
||||
|
||||
gfxQuartzSurface::~gfxQuartzSurface()
|
||||
{
|
||||
CGContextRelease(mCGContext);
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
|
||||
virtual PRInt32 GetDefaultContextFlags() const;
|
||||
|
||||
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
||||
|
||||
protected:
|
||||
CGContextRef mCGContext;
|
||||
gfxSize mSize;
|
||||
|
Loading…
Reference in New Issue
Block a user