зеркало из https://github.com/mozilla/pjs.git
Bug 575521 - Add gfxQuartzSurface::GetAsImageSurface. r=jrmuizel,vlad
This commit is contained in:
Родитель
d66aef2e01
Коммит
09eb9877d3
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче