Fix C extension build warnings the painful way
Some bad distributions (Debian) apparently are not good enough to have a Pillow version from this decade packaged. Therefore, we need to do it the painful way of prefixing our symbols and refactoring everything to use them. A new header file called "utils.h" has been added for this purpose, and it is included in "overviewer.h". The following macros have been prefixed with "OV_": - MIN - MAX - CLAMP - BLEND - MULDIV255 Additionally, the C extension version was bumped to 56 because 55 was reverted back to 54.
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
// increment this value if you've made a change to the c extesion
|
||||
// and want to force users to rebuild
|
||||
#define OVERVIEWER_EXTENSION_VERSION 54
|
||||
#define OVERVIEWER_EXTENSION_VERSION 56
|
||||
|
||||
/* Python PIL, and numpy headers */
|
||||
#include <Python.h>
|
||||
@@ -41,11 +41,9 @@
|
||||
#include <Imaging.h>
|
||||
/* Fix Pillow on mingw-w64 which includes windows.h in Imaging.h */
|
||||
#undef TRANSPARENT
|
||||
/* Utility macros */
|
||||
#include "utils.h"
|
||||
|
||||
/* like (a * b + 127) / 255), but much faster on most platforms
|
||||
from PIL's _imaging.c */
|
||||
#define MULDIV255(a, b, tmp) \
|
||||
(tmp = (a) * (b) + 128, ((((tmp) >> 8) + (tmp)) >> 8))
|
||||
|
||||
/* macro for getting a value out of various numpy arrays the 3D arrays have
|
||||
interesting, swizzled coordinates because minecraft (anvil) stores blocks
|
||||
@@ -55,11 +53,6 @@
|
||||
#define getArrayByte2D(array, x,y) (*(unsigned char *)(PyArray_GETPTR2((array), (y), (x))))
|
||||
|
||||
|
||||
/* generally useful MAX / MIN macros */
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define CLAMP(x, a, b) (MIN(MAX(x, a), b))
|
||||
|
||||
/* in composite.c */
|
||||
Imaging imaging_python_to_c(PyObject *obj);
|
||||
PyObject *alpha_over(PyObject *dest, PyObject *src, PyObject *mask,
|
||||
|
||||
Reference in New Issue
Block a user