コード例 #1
0
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
                                   const gfxSize& desiredSize,
                                   long stride,
                                   gfxImageFormat format,
                                   bool aForPrinting)
    : mCGContext(nullptr), mSize(desiredSize), mForPrinting(aForPrinting)
{
    gfxIntSize size((unsigned int) floor(desiredSize.width),
                    (unsigned int) floor(desiredSize.height));
    if (!CheckSurfaceSize(size))
        MakeInvalid();

    unsigned int width = static_cast<unsigned int>(mSize.width);
    unsigned int height = static_cast<unsigned int>(mSize.height);

    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);
    if (mSurfaceValid) {
      RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface));
    }
}
コード例 #2
0
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
                                   const gfxIntSize& aSize,
                                   long stride,
                                   gfxImageFormat format,
                                   bool aForPrinting)
    : mCGContext(nullptr), mSize(aSize.width, aSize.height), mForPrinting(aForPrinting)
{
    if (!CheckSurfaceSize(aSize))
        MakeInvalid();

    cairo_surface_t *surf = cairo_quartz_surface_create_for_data
        (data, (cairo_format_t) format, aSize.width, aSize.height, stride);

    mCGContext = cairo_quartz_surface_get_cg_context (surf);

    CGContextRetain(mCGContext);

    Init(surf);
    if (mSurfaceValid) {
      RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface));
    }
}
コード例 #3
0
ファイル: gfxQuartzSurface.cpp プロジェクト: MekliCZ/positron
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
                                   const mozilla::gfx::IntSize& aSize,
                                   long stride,
                                   gfxImageFormat format)
    : mCGContext(nullptr), mSize(aSize.width, aSize.height)
{
    if (!CheckSurfaceSize(aSize))
        MakeInvalid();

    cairo_format_t cformat = GfxFormatToCairoFormat(format);
    cairo_surface_t *surf = cairo_quartz_surface_create_for_data
        (data, cformat, aSize.width, aSize.height, stride);

    mCGContext = cairo_quartz_surface_get_cg_context (surf);

    CGContextRetain(mCGContext);

    Init(surf);
    if (mSurfaceValid) {
      RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface));
    }
}