Ejemplo n.º 1
0
gfxWindowsSurface::gfxWindowsSurface(HDC dc, const mozilla::gfx::IntSize& realSize, gfxImageFormat imageFormat) :
    mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
{
    mozilla::gfx::IntSize size(realSize);
    if (!CheckSurfaceSize(size))
        MakeInvalid(size);

    cairo_format_t cformat = gfxImageFormatToCairoFormat(imageFormat);
    cairo_surface_t *surf =
        cairo_win32_surface_create_with_ddb(dc, cformat,
                                            size.width, size.height);

    Init(surf);

    if (mSurfaceValid) {
        // DDBs will generally only use 3 bytes per pixel when RGB24
        int bytesPerPixel = ((imageFormat == gfxImageFormat::RGB24) ? 3 : 4);
        RecordMemoryUsed(size.width * size.height * bytesPerPixel + sizeof(gfxWindowsSurface));
    }

    if (CairoStatus() == 0)
        mDC = cairo_win32_surface_get_dc(CairoSurface());
    else
        mDC = nullptr;
}
gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& size, gfxImageFormat imageFormat) :
    mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
{
    if (!CheckSurfaceSize(size))
        return;

    cairo_surface_t *surf = cairo_win32_surface_create_with_ddb(dc, (cairo_format_t)imageFormat,
                                                                size.width, size.height);
    Init(surf);

    if (CairoStatus() == 0)
        mDC = cairo_win32_surface_get_dc(CairoSurface());
    else
        mDC = nsnull;
}
Ejemplo n.º 3
0
gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& realSize, gfxImageFormat imageFormat) :
    mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
{
    gfxIntSize size(realSize);
    if (!CheckSurfaceSize(size))
        MakeInvalid(size);

    cairo_surface_t *surf = cairo_win32_surface_create_with_dib((cairo_format_t)(int)imageFormat,
                                                                size.width, size.height);

    Init(surf);

    if (CairoStatus() == CAIRO_STATUS_SUCCESS) {
        mDC = cairo_win32_surface_get_dc(CairoSurface());
        RecordMemoryUsed(size.width * size.height * 4 + sizeof(gfxWindowsSurface));
    } else {
        mDC = nullptr;
    }
}
Ejemplo n.º 4
0
gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& size, gfxImageFormat imageFormat) :
    mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
{
    if (!CheckSurfaceSize(size))
        return;

    cairo_surface_t *surf = cairo_win32_surface_create_with_ddb(dc, (cairo_format_t)imageFormat,
                                                                size.width, size.height);

    Init(surf);

    // DDBs will generally only use 3 bytes per pixel when RGB24
    int bytesPerPixel = ((imageFormat == gfxASurface::ImageFormatRGB24) ? 3 : 4);
    RecordMemoryUsed(size.width * size.height * bytesPerPixel + sizeof(gfxWindowsSurface));

    if (CairoStatus() == 0)
        mDC = cairo_win32_surface_get_dc(CairoSurface());
    else
        mDC = nsnull;
}
Ejemplo n.º 5
0
gfxWindowsSurface::gfxWindowsSurface(const mozilla::gfx::IntSize& realSize, gfxImageFormat imageFormat) :
    mOwnsDC(false), mWnd(nullptr)
{
    mozilla::gfx::IntSize size(realSize);
    if (!mozilla::gfx::Factory::CheckSurfaceSize(size))
        MakeInvalid(size);

    cairo_format_t cformat = GfxFormatToCairoFormat(imageFormat);
    cairo_surface_t *surf =
        cairo_win32_surface_create_with_dib(cformat, size.width, size.height);

    Init(surf);

    if (CairoStatus() == CAIRO_STATUS_SUCCESS) {
        mDC = cairo_win32_surface_get_dc(CairoSurface());
        RecordMemoryUsed(size.width * size.height * 4 + sizeof(gfxWindowsSurface));
    } else {
        mDC = nullptr;
    }
}