Pillow-6.0.0/src/libImaging/Storage.c
/* --------------------------------------------------------------------
 * Create a new, internally allocated, image.
 */
Create a new, internally allocated, image.
Create a new internally allocated image .
Imaging
ImagingNewInternal(const char* mode, int xsize, int ysize, int dirty)
{
    Imaging im;
    if (xsize < 0 || ysize < 0) {
        return (Imaging) ImagingError_ValueError("bad image size");
    }
    im = ImagingNewPrologue(mode, xsize, ysize);
    if ( ! im)
        return NULL;
    if (ImagingAllocateArray(im, dirty, ImagingDefaultArena.block_size)) {
        return im;
    }
    ImagingError_Clear();
    if (ImagingAllocateArray(im, dirty, IMAGING_PAGE_SIZE)) {
        return im;
    }
    ImagingDelete(im);
    return NULL;
}
Imaging ImagingNewInternal ( const char * mode , int xsize , int ysize , int dirty ) { Imaging im ; if ( xsize < 0 || ysize < 0 ) { return ( Imaging ) ImagingError_ValueError ( " " ) ; } im = ImagingNewPrologue ( mode , xsize , ysize ) ; if ( ! im ) return NULL ; if ( ImagingAllocateArray ( im , dirty , ImagingDefaultArena . block_size ) ) { return im ; } ImagingError_Clear ( ) ; if ( ImagingAllocateArray ( im , dirty , IMAGING_PAGE_SIZE ) ) { return im ; } ImagingDelete ( im ) ; return NULL ; }
Create a new, internally allocated, image.
Create a new internally allocated image .
// Try to allocate the image once more with smallest possible block size