mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 01:04:29 +03:00
Whitespace, 8 space tabs -> 4 spaces
This commit is contained in:
parent
454a914b56
commit
601ff3bd2f
215
decode.c
215
decode.c
|
@ -66,21 +66,21 @@ PyImaging_DecoderNew(int contextsize)
|
||||||
|
|
||||||
decoder = PyObject_New(ImagingDecoderObject, &ImagingDecoderType);
|
decoder = PyObject_New(ImagingDecoderObject, &ImagingDecoderType);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Clear the decoder state */
|
/* Clear the decoder state */
|
||||||
memset(&decoder->state, 0, sizeof(decoder->state));
|
memset(&decoder->state, 0, sizeof(decoder->state));
|
||||||
|
|
||||||
/* Allocate decoder context */
|
/* Allocate decoder context */
|
||||||
if (contextsize > 0) {
|
if (contextsize > 0) {
|
||||||
context = (void*) calloc(1, contextsize);
|
context = (void*) calloc(1, contextsize);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
Py_DECREF(decoder);
|
Py_DECREF(decoder);
|
||||||
(void) PyErr_NoMemory();
|
(void) PyErr_NoMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
context = 0;
|
context = 0;
|
||||||
|
|
||||||
/* Initialize decoder context */
|
/* Initialize decoder context */
|
||||||
decoder->state.context = context;
|
decoder->state.context = context;
|
||||||
|
@ -129,10 +129,10 @@ _setimage(ImagingDecoderObject* decoder, PyObject* args)
|
||||||
|
|
||||||
/* FIXME: should publish the ImagingType descriptor */
|
/* FIXME: should publish the ImagingType descriptor */
|
||||||
if (!PyArg_ParseTuple(args, "O|(iiii)", &op, &x0, &y0, &x1, &y1))
|
if (!PyArg_ParseTuple(args, "O|(iiii)", &op, &x0, &y0, &x1, &y1))
|
||||||
return NULL;
|
return NULL;
|
||||||
im = PyImaging_AsImaging(op);
|
im = PyImaging_AsImaging(op);
|
||||||
if (!im)
|
if (!im)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->im = im;
|
decoder->im = im;
|
||||||
|
|
||||||
|
@ -140,30 +140,30 @@ _setimage(ImagingDecoderObject* decoder, PyObject* args)
|
||||||
|
|
||||||
/* Setup decoding tile extent */
|
/* Setup decoding tile extent */
|
||||||
if (x0 == 0 && x1 == 0) {
|
if (x0 == 0 && x1 == 0) {
|
||||||
state->xsize = im->xsize;
|
state->xsize = im->xsize;
|
||||||
state->ysize = im->ysize;
|
state->ysize = im->ysize;
|
||||||
} else {
|
} else {
|
||||||
state->xoff = x0;
|
state->xoff = x0;
|
||||||
state->yoff = y0;
|
state->yoff = y0;
|
||||||
state->xsize = x1 - x0;
|
state->xsize = x1 - x0;
|
||||||
state->ysize = y1 - y0;
|
state->ysize = y1 - y0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->xsize <= 0 ||
|
if (state->xsize <= 0 ||
|
||||||
state->xsize + state->xoff > (int) im->xsize ||
|
state->xsize + state->xoff > (int) im->xsize ||
|
||||||
state->ysize <= 0 ||
|
state->ysize <= 0 ||
|
||||||
state->ysize + state->yoff > (int) im->ysize) {
|
state->ysize + state->yoff > (int) im->ysize) {
|
||||||
PyErr_SetString(PyExc_ValueError, "tile cannot extend outside image");
|
PyErr_SetString(PyExc_ValueError, "tile cannot extend outside image");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory buffer (if bits field is set) */
|
/* Allocate memory buffer (if bits field is set) */
|
||||||
if (state->bits > 0) {
|
if (state->bits > 0) {
|
||||||
if (!state->bytes)
|
if (!state->bytes)
|
||||||
state->bytes = (state->bits * state->xsize+7)/8;
|
state->bytes = (state->bits * state->xsize+7)/8;
|
||||||
state->buffer = (UINT8*) malloc(state->bytes);
|
state->buffer = (UINT8*) malloc(state->bytes);
|
||||||
if (!state->buffer)
|
if (!state->buffer)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep a reference to the image object, to make sure it doesn't
|
/* Keep a reference to the image object, to make sure it doesn't
|
||||||
|
@ -178,18 +178,19 @@ _setimage(ImagingDecoderObject* decoder, PyObject* args)
|
||||||
|
|
||||||
static struct PyMethodDef methods[] = {
|
static struct PyMethodDef methods[] = {
|
||||||
{"decode", (PyCFunction)_decode, 1},
|
{"decode", (PyCFunction)_decode, 1},
|
||||||
|
{"cleanup", (PyCFunction)_decode_cleanup, 1},
|
||||||
{"setimage", (PyCFunction)_setimage, 1},
|
{"setimage", (PyCFunction)_setimage, 1},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyTypeObject ImagingDecoderType = {
|
static PyTypeObject ImagingDecoderType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"ImagingDecoder", /*tp_name*/
|
"ImagingDecoder", /*tp_name*/
|
||||||
sizeof(ImagingDecoderObject), /*tp_size*/
|
sizeof(ImagingDecoderObject), /*tp_size*/
|
||||||
0, /*tp_itemsize*/
|
0, /*tp_itemsize*/
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)_dealloc, /*tp_dealloc*/
|
(destructor)_dealloc, /*tp_dealloc*/
|
||||||
0, /*tp_print*/
|
0, /*tp_print*/
|
||||||
0, /*tp_getattr*/
|
0, /*tp_getattr*/
|
||||||
0, /*tp_setattr*/
|
0, /*tp_setattr*/
|
||||||
0, /*tp_compare*/
|
0, /*tp_compare*/
|
||||||
|
@ -227,9 +228,9 @@ get_unpacker(ImagingDecoderObject* decoder, const char* mode,
|
||||||
|
|
||||||
unpack = ImagingFindUnpacker(mode, rawmode, &bits);
|
unpack = ImagingFindUnpacker(mode, rawmode, &bits);
|
||||||
if (!unpack) {
|
if (!unpack) {
|
||||||
Py_DECREF(decoder);
|
Py_DECREF(decoder);
|
||||||
PyErr_SetString(PyExc_ValueError, "unknown raw mode");
|
PyErr_SetString(PyExc_ValueError, "unknown raw mode");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder->state.shuffle = unpack;
|
decoder->state.shuffle = unpack;
|
||||||
|
@ -240,7 +241,7 @@ get_unpacker(ImagingDecoderObject* decoder, const char* mode,
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* BIT (packed fields) */
|
/* BIT (packed fields) */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -256,16 +257,16 @@ PyImaging_BitDecoderNew(PyObject* self, PyObject* args)
|
||||||
int ystep = 1;
|
int ystep = 1;
|
||||||
if (!PyArg_ParseTuple(args, "s|iiiii", &mode, &bits, &pad, &fill,
|
if (!PyArg_ParseTuple(args, "s|iiiii", &mode, &bits, &pad, &fill,
|
||||||
&sign, &ystep))
|
&sign, &ystep))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strcmp(mode, "F") != 0) {
|
if (strcmp(mode, "F") != 0) {
|
||||||
PyErr_SetString(PyExc_ValueError, "bad image mode");
|
PyErr_SetString(PyExc_ValueError, "bad image mode");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(BITSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(BITSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingBitDecode;
|
decoder->decode = ImagingBitDecode;
|
||||||
|
|
||||||
|
@ -281,7 +282,7 @@ PyImaging_BitDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* FLI */
|
/* FLI */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -291,7 +292,7 @@ PyImaging_FliDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingFliDecode;
|
decoder->decode = ImagingFliDecode;
|
||||||
|
|
||||||
|
@ -300,7 +301,7 @@ PyImaging_FliDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* GIF */
|
/* GIF */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -312,16 +313,16 @@ PyImaging_GifDecoderNew(PyObject* self, PyObject* args)
|
||||||
int bits = 8;
|
int bits = 8;
|
||||||
int interlace = 0;
|
int interlace = 0;
|
||||||
if (!PyArg_ParseTuple(args, "s|ii", &mode, &bits, &interlace))
|
if (!PyArg_ParseTuple(args, "s|ii", &mode, &bits, &interlace))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strcmp(mode, "L") != 0 && strcmp(mode, "P") != 0) {
|
if (strcmp(mode, "L") != 0 && strcmp(mode, "P") != 0) {
|
||||||
PyErr_SetString(PyExc_ValueError, "bad image mode");
|
PyErr_SetString(PyExc_ValueError, "bad image mode");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(GIFDECODERSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(GIFDECODERSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingGifDecode;
|
decoder->decode = ImagingGifDecode;
|
||||||
|
|
||||||
|
@ -333,7 +334,7 @@ PyImaging_GifDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* HEX */
|
/* HEX */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -344,14 +345,14 @@ PyImaging_HexDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* mode;
|
char* mode;
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingHexDecode;
|
decoder->decode = ImagingHexDecode;
|
||||||
|
|
||||||
|
@ -360,7 +361,7 @@ PyImaging_HexDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* LZW */
|
/* LZW */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -372,14 +373,14 @@ PyImaging_TiffLzwDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
int filter = 0;
|
int filter = 0;
|
||||||
if (!PyArg_ParseTuple(args, "ss|i", &mode, &rawmode, &filter))
|
if (!PyArg_ParseTuple(args, "ss|i", &mode, &rawmode, &filter))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(LZWSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(LZWSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingLzwDecode;
|
decoder->decode = ImagingLzwDecode;
|
||||||
|
|
||||||
|
@ -389,7 +390,7 @@ PyImaging_TiffLzwDecoderNew(PyObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* LibTiff */
|
/* LibTiff */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef HAVE_LIBTIFF
|
#ifdef HAVE_LIBTIFF
|
||||||
|
@ -409,17 +410,17 @@ PyImaging_LibTiffDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
char* compname;
|
char* compname;
|
||||||
int compression;
|
int compression;
|
||||||
int fp;
|
int fp;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "sssi", &mode, &rawmode, &compname, &fp))
|
if (! PyArg_ParseTuple(args, "sssi", &mode, &rawmode, &compname, &fp))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
TRACE(("new tiff decoder %s\n", compname));
|
TRACE(("new tiff decoder %s\n", compname));
|
||||||
|
|
||||||
/* UNDONE -- we can probably do almost any arbitrary compression here,
|
/* UNDONE -- we can probably do almost any arbitrary compression here,
|
||||||
* since we're effective passing in the whole file in one shot and
|
* since we're effective passing in the whole file in one shot and
|
||||||
* getting back the data row by row. V2 maybe
|
* getting back the data row by row. V2 maybe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strcasecmp(compname, "tiff_ccitt") == 0) {
|
if (strcasecmp(compname, "tiff_ccitt") == 0) {
|
||||||
compression = COMPRESSION_CCITTRLE;
|
compression = COMPRESSION_CCITTRLE;
|
||||||
|
@ -459,7 +460,7 @@ PyImaging_LibTiffDecoderNew(PyObject* self, PyObject* args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* MSP */
|
/* MSP */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -469,10 +470,10 @@ PyImaging_MspDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, "1", "1") < 0)
|
if (get_unpacker(decoder, "1", "1") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingMspDecode;
|
decoder->decode = ImagingMspDecode;
|
||||||
|
|
||||||
|
@ -481,7 +482,7 @@ PyImaging_MspDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* PackBits */
|
/* PackBits */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -492,14 +493,14 @@ PyImaging_PackbitsDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* mode;
|
char* mode;
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingPackbitsDecode;
|
decoder->decode = ImagingPackbitsDecode;
|
||||||
|
|
||||||
|
@ -508,7 +509,7 @@ PyImaging_PackbitsDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* PCD */
|
/* PCD */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -518,11 +519,11 @@ PyImaging_PcdDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Unpack from PhotoYCC to RGB */
|
/* Unpack from PhotoYCC to RGB */
|
||||||
if (get_unpacker(decoder, "RGB", "YCC;P") < 0)
|
if (get_unpacker(decoder, "RGB", "YCC;P") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingPcdDecode;
|
decoder->decode = ImagingPcdDecode;
|
||||||
|
|
||||||
|
@ -531,7 +532,7 @@ PyImaging_PcdDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* PCX */
|
/* PCX */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -543,14 +544,14 @@ PyImaging_PcxDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
int stride;
|
int stride;
|
||||||
if (!PyArg_ParseTuple(args, "ssi", &mode, &rawmode, &stride))
|
if (!PyArg_ParseTuple(args, "ssi", &mode, &rawmode, &stride))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->state.bytes = stride;
|
decoder->state.bytes = stride;
|
||||||
|
|
||||||
|
@ -561,7 +562,7 @@ PyImaging_PcxDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* RAW */
|
/* RAW */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -574,14 +575,14 @@ PyImaging_RawDecoderNew(PyObject* self, PyObject* args)
|
||||||
int stride = 0;
|
int stride = 0;
|
||||||
int ystep = 1;
|
int ystep = 1;
|
||||||
if (!PyArg_ParseTuple(args, "ss|ii", &mode, &rawmode, &stride, &ystep))
|
if (!PyArg_ParseTuple(args, "ss|ii", &mode, &rawmode, &stride, &ystep))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(RAWSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(RAWSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingRawDecode;
|
decoder->decode = ImagingRawDecode;
|
||||||
|
|
||||||
|
@ -594,7 +595,7 @@ PyImaging_RawDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* SUN RLE */
|
/* SUN RLE */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -605,14 +606,14 @@ PyImaging_SunRleDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* mode;
|
char* mode;
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
if (!PyArg_ParseTuple(args, "ss", &mode, &rawmode))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingSunRleDecode;
|
decoder->decode = ImagingSunRleDecode;
|
||||||
|
|
||||||
|
@ -621,7 +622,7 @@ PyImaging_SunRleDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* TGA RLE */
|
/* TGA RLE */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -634,14 +635,14 @@ PyImaging_TgaRleDecoderNew(PyObject* self, PyObject* args)
|
||||||
int ystep = 1;
|
int ystep = 1;
|
||||||
int depth = 8;
|
int depth = 8;
|
||||||
if (!PyArg_ParseTuple(args, "ss|ii", &mode, &rawmode, &ystep, &depth))
|
if (!PyArg_ParseTuple(args, "ss|ii", &mode, &rawmode, &ystep, &depth))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingTgaRleDecode;
|
decoder->decode = ImagingTgaRleDecode;
|
||||||
|
|
||||||
|
@ -653,7 +654,7 @@ PyImaging_TgaRleDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* XBM */
|
/* XBM */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -663,10 +664,10 @@ PyImaging_XbmDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(0);
|
decoder = PyImaging_DecoderNew(0);
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, "1", "1;R") < 0)
|
if (get_unpacker(decoder, "1", "1;R") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingXbmDecode;
|
decoder->decode = ImagingXbmDecode;
|
||||||
|
|
||||||
|
@ -675,7 +676,7 @@ PyImaging_XbmDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* ZIP */
|
/* ZIP */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
|
@ -691,14 +692,14 @@ PyImaging_ZipDecoderNew(PyObject* self, PyObject* args)
|
||||||
char* rawmode;
|
char* rawmode;
|
||||||
int interlaced = 0;
|
int interlaced = 0;
|
||||||
if (!PyArg_ParseTuple(args, "ss|i", &mode, &rawmode, &interlaced))
|
if (!PyArg_ParseTuple(args, "ss|i", &mode, &rawmode, &interlaced))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(ZIPSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(ZIPSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingZipDecode;
|
decoder->decode = ImagingZipDecode;
|
||||||
|
|
||||||
|
@ -710,7 +711,7 @@ PyImaging_ZipDecoderNew(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* JPEG */
|
/* JPEG */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef HAVE_LIBJPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
|
@ -718,15 +719,15 @@ PyImaging_ZipDecoderNew(PyObject* self, PyObject* args)
|
||||||
/* We better define this decoder last in this file, so the following
|
/* We better define this decoder last in this file, so the following
|
||||||
undef's won't mess things up for the Imaging library proper. */
|
undef's won't mess things up for the Imaging library proper. */
|
||||||
|
|
||||||
#undef HAVE_PROTOTYPES
|
#undef HAVE_PROTOTYPES
|
||||||
#undef HAVE_STDDEF_H
|
#undef HAVE_STDDEF_H
|
||||||
#undef HAVE_STDLIB_H
|
#undef HAVE_STDLIB_H
|
||||||
#undef UINT8
|
#undef UINT8
|
||||||
#undef UINT16
|
#undef UINT16
|
||||||
#undef UINT32
|
#undef UINT32
|
||||||
#undef INT8
|
#undef INT8
|
||||||
#undef INT16
|
#undef INT16
|
||||||
#undef INT32
|
#undef INT32
|
||||||
|
|
||||||
#include "Jpeg.h"
|
#include "Jpeg.h"
|
||||||
|
|
||||||
|
@ -742,17 +743,17 @@ PyImaging_JpegDecoderNew(PyObject* self, PyObject* args)
|
||||||
int draft = 0;
|
int draft = 0;
|
||||||
if (!PyArg_ParseTuple(args, "ssz|ii", &mode, &rawmode, &jpegmode,
|
if (!PyArg_ParseTuple(args, "ssz|ii", &mode, &rawmode, &jpegmode,
|
||||||
&scale, &draft))
|
&scale, &draft))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!jpegmode)
|
if (!jpegmode)
|
||||||
jpegmode = "";
|
jpegmode = "";
|
||||||
|
|
||||||
decoder = PyImaging_DecoderNew(sizeof(JPEGSTATE));
|
decoder = PyImaging_DecoderNew(sizeof(JPEGSTATE));
|
||||||
if (decoder == NULL)
|
if (decoder == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
decoder->decode = ImagingJpegDecode;
|
decoder->decode = ImagingJpegDecode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user