mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-01 04:46:18 +03:00
use mode structs in Draw.c
This commit is contained in:
parent
da808ce436
commit
2beb5fa67c
|
@ -68,7 +68,7 @@ typedef void (*hline_handler)(Imaging, int, int, int, int);
|
||||||
static inline void
|
static inline void
|
||||||
point8(Imaging im, int x, int y, int ink) {
|
point8(Imaging im, int x, int y, int ink) {
|
||||||
if (x >= 0 && x < im->xsize && y >= 0 && y < im->ysize) {
|
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
|
#ifdef WORDS_BIGENDIAN
|
||||||
im->image8[y][x * 2] = (UINT8)(ink >> 8);
|
im->image8[y][x * 2] = (UINT8)(ink >> 8);
|
||||||
im->image8[y][x * 2 + 1] = (UINT8)ink;
|
im->image8[y][x * 2 + 1] = (UINT8)ink;
|
||||||
|
@ -118,7 +118,7 @@ hline8(Imaging im, int x0, int y0, int x1, int ink) {
|
||||||
x1 = im->xsize - 1;
|
x1 = im->xsize - 1;
|
||||||
}
|
}
|
||||||
if (x0 <= x1) {
|
if (x0 <= x1) {
|
||||||
pixelwidth = strncmp(im->mode, "I;16", 4) == 0 ? 2 : 1;
|
pixelwidth = strncmp(im->mode->name, "I;16", 4) == 0 ? 2 : 1;
|
||||||
memset(
|
memset(
|
||||||
im->image8[y0] + x0 * pixelwidth, (UINT8)ink, (x1 - x0 + 1) * pixelwidth
|
im->image8[y0] + x0 * pixelwidth, (UINT8)ink, (x1 - x0 + 1) * pixelwidth
|
||||||
);
|
);
|
||||||
|
@ -662,7 +662,7 @@ DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba, polygon32rgba};
|
||||||
#define DRAWINIT() \
|
#define DRAWINIT() \
|
||||||
if (im->image8) { \
|
if (im->image8) { \
|
||||||
draw = &draw8; \
|
draw = &draw8; \
|
||||||
if (strncmp(im->mode, "I;16", 4) == 0) { \
|
if (strncmp(im->mode->name, "I;16", 4) == 0) { \
|
||||||
ink = INK16(ink_); \
|
ink = INK16(ink_); \
|
||||||
} else { \
|
} else { \
|
||||||
ink = INK8(ink_); \
|
ink = INK8(ink_); \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user