PassRefPtr<Image> ShareableBitmap::createImage()
{
    RefPtr<cairo_surface_t> surface = createCairoSurface();
    if (!surface)
        return 0;

    return BitmapImage::create(surface.release());
}
PassRefPtr<Image> ShareableBitmap::createImage()
{
    RefPtr<cairo_surface_t> surface = createCairoSurface();
    if (!surface)
        return 0;

    // BitmapImage::create adopts the cairo_surface_t that's passed in, which is why we need to leakRef here.
    return BitmapImage::create(surface.release().leakRef());
}
PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
    RefPtr<cairo_surface_t> image = createCairoSurface();
    RefPtr<cairo_t> bitmapContext = adoptRef(cairo_create(image.get()));
    return adoptPtr(new GraphicsContext(bitmapContext.get()));
}
std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
    RefPtr<cairo_surface_t> image = createCairoSurface();
    RefPtr<cairo_t> bitmapContext = adoptRef(cairo_create(image.get()));
    return std::make_unique<GraphicsContext>(bitmapContext.get());
}