mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-27 08:30:05 +03:00
use mode structs in Draw.c
This commit is contained in:
parent
9bf3495898
commit
bcfe5f2172
|
@ -68,7 +68,7 @@ typedef void (*hline_handler)(Imaging, int, int, int, int, Imaging);
|
|||
static inline void
|
||||
point8(Imaging im, int x, int y, int ink) {
|
||||
if (x >= 0 && x < im->xsize && y >= 0 && y < im->ysize) {
|
||||
if (strncmp(im->mode, "I;16", 4) == 0) {
|
||||
if (strncmp(im->mode->name, "I;16", 4) == 0) {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
im->image8[y][x * 2] = (UINT8)(ink >> 8);
|
||||
im->image8[y][x * 2 + 1] = (UINT8)ink;
|
||||
|
@ -117,13 +117,13 @@ hline8(Imaging im, int x0, int y0, int x1, int ink, Imaging mask) {
|
|||
}
|
||||
if (x0 <= x1) {
|
||||
int bigendian = -1;
|
||||
if (strncmp(im->mode, "I;16", 4) == 0) {
|
||||
if (isModeI16(im->mode)) {
|
||||
bigendian =
|
||||
(
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
strcmp(im->mode, "I;16") == 0 || strcmp(im->mode, "I;16L") == 0
|
||||
im->mode == IMAGING_MODE_I_16 || im->mode == IMAGING_MODE_I_16L
|
||||
#else
|
||||
strcmp(im->mode, "I;16B") == 0
|
||||
im->mode == IMAGING_MODE_I_16B
|
||||
#endif
|
||||
)
|
||||
? 1
|
||||
|
@ -672,17 +672,17 @@ DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba};
|
|||
/* Interface */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#define DRAWINIT() \
|
||||
if (im->image8) { \
|
||||
draw = &draw8; \
|
||||
if (strncmp(im->mode, "I;16", 4) == 0) { \
|
||||
ink = INK16(ink_); \
|
||||
} else { \
|
||||
ink = INK8(ink_); \
|
||||
} \
|
||||
} else { \
|
||||
draw = (op) ? &draw32rgba : &draw32; \
|
||||
memcpy(&ink, ink_, sizeof(ink)); \
|
||||
#define DRAWINIT() \
|
||||
if (im->image8) { \
|
||||
draw = &draw8; \
|
||||
if (strncmp(im->mode->name, "I;16", 4) == 0) { \
|
||||
ink = INK16(ink_); \
|
||||
} else { \
|
||||
ink = INK8(ink_); \
|
||||
} \
|
||||
} else { \
|
||||
draw = (op) ? &draw32rgba : &draw32; \
|
||||
memcpy(&ink, ink_, sizeof(ink)); \
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue
Block a user