0

Implement straggler standard integer types

This commit is contained in:
Wunkolo
2019-06-26 10:29:10 -07:00
parent 5b212dc585
commit 22840d5a97
4 changed files with 14 additions and 9 deletions

View File

@@ -56,7 +56,9 @@ imaging_python_to_c(PyObject* obj) {
in these composite functions -- even handles auto-sizing to src! */ in these composite functions -- even handles auto-sizing to src! */
static inline void static inline void
setup_source_destination(Imaging src, Imaging dest, setup_source_destination(Imaging src, Imaging dest,
int* sx, int* sy, int* dx, int* dy, int* xsize, int* ysize) { int32_t* sx, int32_t* sy,
int32_t* dx, int32_t* dy,
int32_t* xsize, int32_t* ysize) {
/* handle negative/zero sizes appropriately */ /* handle negative/zero sizes appropriately */
if (*xsize <= 0 || *ysize <= 0) { if (*xsize <= 0 || *ysize <= 0) {
*xsize = src->xsize; *xsize = src->xsize;
@@ -275,9 +277,11 @@ alpha_over_wrap(PyObject* self, PyObject* args) {
* also, it multiplies instead of doing an over operation * also, it multiplies instead of doing an over operation
*/ */
PyObject* PyObject*
tint_with_mask(PyObject* dest, uint8_t sr, uint8_t sg, tint_with_mask(PyObject* dest,
uint8_t sb, uint8_t sa, uint8_t sr, uint8_t sg, uint8_t sb, uint8_t sa,
PyObject* mask, int32_t dx, int32_t dy, int32_t xsize, int32_t ysize) { PyObject* mask,
int32_t dx, int32_t dy,
int32_t xsize, int32_t ysize) {
/* libImaging handles */ /* libImaging handles */
Imaging imDest, imMask; Imaging imDest, imMask;
/* cached blend properties */ /* cached blend properties */
@@ -378,7 +382,8 @@ draw_triangle(PyObject* dest, int32_t inclusive,
uint8_t r1, uint8_t g1, uint8_t b1, uint8_t r1, uint8_t g1, uint8_t b1,
int32_t x2, int32_t y2, int32_t x2, int32_t y2,
uint8_t r2, uint8_t g2, uint8_t b2, uint8_t r2, uint8_t g2, uint8_t b2,
int32_t tux, int32_t tuy, int* touchups, uint32_t num_touchups) { int32_t tux, int32_t tuy,
int32_t* touchups, uint32_t num_touchups) {
/* destination image */ /* destination image */
Imaging imDest; Imaging imDest;

View File

@@ -28,7 +28,7 @@ static int32_t endianness = UNKNOWN_ENDIAN;
void init_endian(void) { void init_endian(void) {
/* figure out what our endianness is! */ /* figure out what our endianness is! */
int16_t word = 0x0001; int16_t word = 0x0001;
char* byte = (char*)(&word); uint8_t* byte = (uint8_t*)(&word);
endianness = byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN; endianness = byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN;
} }

View File

@@ -70,7 +70,7 @@ PyObject* draw_triangle(PyObject* dest, int32_t inclusive,
uint8_t r1, uint8_t g1, uint8_t b1, uint8_t r1, uint8_t g1, uint8_t b1,
int32_t x2, int32_t y2, int32_t x2, int32_t y2,
uint8_t r2, uint8_t g2, uint8_t b2, uint8_t r2, uint8_t g2, uint8_t b2,
int32_t tux, int32_t tuy, int* touchups, uint32_t num_touchups); int32_t tux, int32_t tuy, int32_t* touchups, uint32_t num_touchups);
PyObject* resize_half(PyObject* dest, PyObject* src); PyObject* resize_half(PyObject* dest, PyObject* src);
PyObject* resize_half_wrap(PyObject* self, PyObject* args); PyObject* resize_half_wrap(PyObject* self, PyObject* args);

View File

@@ -55,10 +55,10 @@ typedef struct {
bool (*start)(void*, RenderState*, PyObject*); bool (*start)(void*, RenderState*, PyObject*);
void (*finish)(void*, RenderState*); void (*finish)(void*, RenderState*);
/* returns true to skip rendering this block because it's not visible */ /* returns true to skip rendering this block because it's not visible */
bool (*occluded)(void*, RenderState*, int, int, int); bool (*occluded)(void*, RenderState*, int32_t, int32_t, int32_t);
/* returns true to skip rendering this block because the user doesn't /* returns true to skip rendering this block because the user doesn't
* want it visible */ * want it visible */
bool (*hidden)(void*, RenderState*, int, int, int); bool (*hidden)(void*, RenderState*, int32_t, int32_t, int32_t);
/* last two arguments are img and mask, from texture lookup */ /* last two arguments are img and mask, from texture lookup */
void (*draw)(void*, RenderState*, PyObject*, PyObject*, PyObject*); void (*draw)(void*, RenderState*, PyObject*, PyObject*, PyObject*);
} RenderPrimitiveInterface; } RenderPrimitiveInterface;