mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 611433 - Add gfxQuartzImage constructor for data pointers. r=jrmuizel a=blocking2.0
This commit is contained in:
parent
233f393c74
commit
63935bac8b
@ -87,6 +87,29 @@ gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf,
|
||||
Init(csurf, PR_TRUE);
|
||||
}
|
||||
|
||||
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
|
||||
const gfxSize& size,
|
||||
long stride,
|
||||
gfxImageFormat format,
|
||||
PRBool aForPrinting)
|
||||
: mCGContext(nsnull), mSize(size), mForPrinting(aForPrinting)
|
||||
{
|
||||
unsigned int width = (unsigned int) floor(size.width);
|
||||
unsigned int height = (unsigned int) floor(size.height);
|
||||
|
||||
if (!CheckSurfaceSize(gfxIntSize(width, height)))
|
||||
return;
|
||||
|
||||
cairo_surface_t *surf = cairo_quartz_surface_create_for_data
|
||||
(data, (cairo_format_t) format, width, height, stride);
|
||||
|
||||
mCGContext = cairo_quartz_surface_get_cg_context (surf);
|
||||
|
||||
CGContextRetain(mCGContext);
|
||||
|
||||
Init(surf);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxQuartzSurface::CreateSimilarSurface(gfxContentType aType,
|
||||
const gfxIntSize& aSize)
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, PRBool aForPrinting = PR_FALSE);
|
||||
gfxQuartzSurface(CGContextRef context, const gfxSize& size, PRBool aForPrinting = PR_FALSE);
|
||||
gfxQuartzSurface(cairo_surface_t *csurf, PRBool aForPrinting = PR_FALSE);
|
||||
gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, PRBool aForPrinting = PR_FALSE);
|
||||
|
||||
virtual ~gfxQuartzSurface();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user