|
41 | 41 | #define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v)) |
42 | 42 |
|
43 | 43 | #define INK8(ink) (*(UINT8 *)ink) |
| 44 | +#define INK16(ink) (*(UINT16 *)ink) |
44 | 45 |
|
45 | 46 | /* |
46 | 47 | * Rounds around zero (up=away from zero, down=towards zero) |
@@ -68,8 +69,13 @@ static inline void |
68 | 69 | point8(Imaging im, int x, int y, int ink) { |
69 | 70 | if (x >= 0 && x < im->xsize && y >= 0 && y < im->ysize) { |
70 | 71 | if (strncmp(im->mode, "I;16", 4) == 0) { |
71 | | - im->image8[y][x * 2] = (UINT8)ink; |
| 72 | +#ifdef WORDS_BIGENDIAN |
| 73 | + im->image8[y][x * 2] = (UINT8)(ink >> 8); |
72 | 74 | im->image8[y][x * 2 + 1] = (UINT8)ink; |
| 75 | +#else |
| 76 | + im->image8[y][x * 2] = (UINT8)ink; |
| 77 | + im->image8[y][x * 2 + 1] = (UINT8)(ink >> 8); |
| 78 | +#endif |
73 | 79 | } else { |
74 | 80 | im->image8[y][x] = (UINT8)ink; |
75 | 81 | } |
@@ -631,13 +637,17 @@ DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba, polygon32rgba}; |
631 | 637 | /* Interface */ |
632 | 638 | /* -------------------------------------------------------------------- */ |
633 | 639 |
|
634 | | -#define DRAWINIT() \ |
635 | | - if (im->image8) { \ |
636 | | - draw = &draw8; \ |
637 | | - ink = INK8(ink_); \ |
638 | | - } else { \ |
639 | | - draw = (op) ? &draw32rgba : &draw32; \ |
640 | | - memcpy(&ink, ink_, sizeof(ink)); \ |
| 640 | +#define DRAWINIT() \ |
| 641 | + if (im->image8) { \ |
| 642 | + draw = &draw8; \ |
| 643 | + if (strncmp(im->mode, "I;16", 4) == 0) { \ |
| 644 | + ink = INK16(ink_); \ |
| 645 | + } else { \ |
| 646 | + ink = INK8(ink_); \ |
| 647 | + } \ |
| 648 | + } else { \ |
| 649 | + draw = (op) ? &draw32rgba : &draw32; \ |
| 650 | + memcpy(&ink, ink_, sizeof(ink)); \ |
641 | 651 | } |
642 | 652 |
|
643 | 653 | int |
|
0 commit comments