mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-29 02:34:10 +03:00
use mode structs in map.c
This commit is contained in:
parent
ebbe5d844b
commit
1b1f250b74
|
@ -55,7 +55,7 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
|
||||||
|
|
||||||
PyObject *target;
|
PyObject *target;
|
||||||
Py_buffer view;
|
Py_buffer view;
|
||||||
char *mode;
|
char *mode_name;
|
||||||
char *codec;
|
char *codec;
|
||||||
Py_ssize_t offset;
|
Py_ssize_t offset;
|
||||||
int xsize, ysize;
|
int xsize, ysize;
|
||||||
|
@ -70,7 +70,7 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
|
||||||
&ysize,
|
&ysize,
|
||||||
&codec,
|
&codec,
|
||||||
&offset,
|
&offset,
|
||||||
&mode,
|
&mode_name,
|
||||||
&stride,
|
&stride,
|
||||||
&ystep
|
&ystep
|
||||||
)) {
|
)) {
|
||||||
|
@ -82,8 +82,10 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Mode * const mode = findMode(mode_name);
|
||||||
|
|
||||||
if (stride <= 0) {
|
if (stride <= 0) {
|
||||||
if (!strcmp(mode, "L") || !strcmp(mode, "P")) {
|
if (mode == IMAGING_MODE_L || mode == IMAGING_MODE_P) {
|
||||||
stride = xsize;
|
stride = xsize;
|
||||||
} else if (isModeI16(mode)) {
|
} else if (isModeI16(mode)) {
|
||||||
stride = xsize * 2;
|
stride = xsize * 2;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user