Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@
#include <math.h>
#include <stddef.h>

#undef VERBOSE

#define B16(p, i) ((((int)p[(i)]) << 8) + p[(i) + 1])
#define L16(p, i) ((((int)p[(i) + 1]) << 8) + p[(i)])
#define S16(v) ((v) < 32768 ? (v) : ((v) - 65536))
Expand Down Expand Up @@ -166,10 +164,6 @@ PyImagingNew(Imaging imOut) {
return NULL;
}

#ifdef VERBOSE
printf("imaging %p allocated\n", imagep);
#endif

imagep->image = imOut;
imagep->access = ImagingAccessNew(imOut);

Expand All @@ -178,10 +172,6 @@ PyImagingNew(Imaging imOut) {

static void
_dealloc(ImagingObject *imagep) {
#ifdef VERBOSE
printf("imaging %p deleted\n", imagep);
#endif

if (imagep->access) {
ImagingAccessDelete(imagep->image, imagep->access);
}
Expand Down
4 changes: 0 additions & 4 deletions src/_imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,6 @@ cms_profile_is_intent_supported(CmsProfileObject *self, PyObject *args) {
}

result = cmsIsIntentSupported(self->profile, intent, direction);

/* printf("cmsIsIntentSupported(%p, %d, %d) => %d\n", self->profile, intent,
* direction, result); */

return PyLong_FromLong(result != 0);
}

Expand Down
21 changes: 0 additions & 21 deletions src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ WebPEncode_wrapper(PyObject *self, PyObject *args) {
WebPData exif = {exif_bytes, i_exif_size};
WebPData xmp = {xmp_bytes, i_xmp_size};
WebPMuxError err;
int dbg = 0;

int copy_data = 0; // value 1 indicates given data WILL be copied to the mux
// and value 0 indicates data will NOT be copied.
Expand All @@ -687,41 +686,21 @@ WebPEncode_wrapper(PyObject *self, PyObject *args) {
}
WebPMuxSetImage(mux, &image, copy_data);

if (dbg) {
/* was getting %ld icc_size == 0, icc_size>0 was true */
fprintf(stderr, "icc size %d, %d \n", i_icc_size, i_icc_size > 0);
}

if (i_icc_size > 0) {
if (dbg) {
fprintf(stderr, "Adding ICC Profile\n");
}
err = WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
if (err != WEBP_MUX_OK) {
return HandleMuxError(err, "ICCP");
}
}

if (dbg) {
fprintf(stderr, "exif size %d \n", i_exif_size);
}
if (i_exif_size > 0) {
if (dbg) {
fprintf(stderr, "Adding Exif Data\n");
}
err = WebPMuxSetChunk(mux, "EXIF", &exif, copy_data);
if (err != WEBP_MUX_OK) {
return HandleMuxError(err, "EXIF");
}
}

if (dbg) {
fprintf(stderr, "xmp size %d \n", i_xmp_size);
}
if (i_xmp_size > 0) {
if (dbg) {
fprintf(stderr, "Adding XMP Data\n");
}
err = WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
if (err != WEBP_MUX_OK) {
return HandleMuxError(err, "XMP ");
Expand Down
2 changes: 0 additions & 2 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,6 @@ PyImaging_LibTiffDecoderNew(PyObject *self, PyObject *args) {
const ModeID mode = findModeID(mode_name);
const RawModeID rawmode = findRawModeID(rawmode_name);

TRACE(("new tiff decoder %s\n", compname));

decoder = PyImaging_DecoderNew(sizeof(TIFFSTATE));
if (decoder == NULL) {
return NULL;
Expand Down
11 changes: 0 additions & 11 deletions src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
return NULL;
} else {
tags_size = PyList_Size(tags);
TRACE(("tags size: %d\n", (int)tags_size));
for (pos = 0; pos < tags_size; pos++) {
item = PyList_GetItemRef(tags, pos);
if (item == NULL) {
Expand All @@ -739,8 +738,6 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
return NULL;
}

TRACE(("new tiff encoder %s fp: %d, filename: %s \n", compname, fp, filename));

encoder = PyImaging_EncoderNew(sizeof(TIFFSTATE));
if (encoder == NULL) {
return NULL;
Expand Down Expand Up @@ -865,7 +862,6 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
);
} else if (is_var_length) {
Py_ssize_t len, i;
TRACE(("Setting from Tuple: %d \n", key_int));
len = PyTuple_Size(value);

if (key_int == TIFFTAG_COLORMAP) {
Expand Down Expand Up @@ -1050,17 +1046,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
status = ImagingLibTiffSetField(
&encoder->state, (ttag_t)key_int, (uint64_t)PyLong_AsLongLong(value)
);
} else {
TRACE(
("Unhandled type for key %d : %s \n",
key_int,
PyBytes_AsString(PyObject_Str(value)))
);
}
}
Py_DECREF(item);
if (!status) {
TRACE(("Error setting Field\n"));
Py_DECREF(encoder);
PyErr_SetString(PyExc_RuntimeError, "Error setting from dictionary");
return NULL;
Expand Down
6 changes: 0 additions & 6 deletions src/libImaging/Arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
#include "Imaging.h"
#include <string.h>

/* struct ArrowSchema* */
/* _arrow_schema_channel(char* channel, char* format) { */

/* } */

static void
ReleaseExportedSchema(struct ArrowSchema *array) {
// TODO here: release and/or deallocate all data directly owned by
Expand Down Expand Up @@ -368,7 +363,6 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
if (!array->buffers) {
goto err;
}
// assert(array->buffers != NULL);
array->buffers[0] = NULL; // no nulls, null bitmap can be omitted

// if it's not 1 band, it's an int32 at the moment. 4 uint8 bands.
Expand Down
2 changes: 0 additions & 2 deletions src/libImaging/BoxBlur.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ ImagingHorizontalBoxBlur(Imaging imOut, Imaging imIn, float floatRadius) {
return ImagingError_MemoryError();
}

// printf(">>> %d %d %d\n", radius, ww, fw);

ImagingSectionEnter(&cookie);

if (imIn->image8) {
Expand Down
30 changes: 1 addition & 29 deletions src/libImaging/Dib.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,7 @@ ImagingNewDIB(const ModeID mode, int xsize, int ysize) {

dib->palette = CreatePalette(pal);
} else if (mode == IMAGING_MODE_RGB) {
#ifdef CUBE216

/* Colour DIB. Create a 6x6x6 colour cube (216 entries) and
* add 20 extra graylevels for best result with grayscale
* images. */

i = 10;
for (r = 0; r < 256; r += 51) {
for (g = 0; g < 256; g += 51) {
for (b = 0; b < 256; b += 51) {
pal->palPalEntry[i].peRed = r;
pal->palPalEntry[i].peGreen = g;
pal->palPalEntry[i].peBlue = b;
i++;
}
}
}
for (r = 1; r < 22 - 1; r++) {
/* Black and white are already provided by the cube. */
pal->palPalEntry[i].peRed = pal->palPalEntry[i].peGreen =
pal->palPalEntry[i].peBlue = r * 255 / (22 - 1);
i++;
}

#else

/* Colour DIB. Alternate palette. */
/* Colour DIB. */

i = 10;
for (r = 0; r < 256; r += 37) {
Expand All @@ -196,8 +170,6 @@ ImagingNewDIB(const ModeID mode, int xsize, int ysize) {
}
}

#endif

dib->palette = CreatePalette(pal);
}
}
Expand Down
28 changes: 0 additions & 28 deletions src/libImaging/Draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,6 @@ polygon_generic(

static inline void
add_edge(Edge *e, int x0, int y0, int x1, int y1) {
/* printf("edge %d %d %d %d\n", x0, y0, x1, y1); */

if (x0 <= x1) {
e->xmin = x0, e->xmax = x1;
} else {
Expand Down Expand Up @@ -1266,31 +1264,6 @@ typedef void (*clip_ellipse_init)(
clip_ellipse_state *, int32_t, int32_t, int32_t, float, float
);

void
debug_clip_tree(clip_node *root, int space) {
if (root == NULL) {
return;
}
if (root->type == CT_CLIP) {
int t = space;
while (t--) {
fputc(' ', stderr);
}
fprintf(stderr, "clip %+fx%+fy%+f > 0\n", root->a, root->b, root->c);
} else {
debug_clip_tree(root->l, space + 2);
int t = space;
while (t--) {
fputc(' ', stderr);
}
fprintf(stderr, "%s\n", root->type == CT_AND ? "and" : "or");
debug_clip_tree(root->r, space + 2);
}
if (space == 0) {
fputc('\n', stderr);
}
}

// Resulting angles will satisfy 0 <= al < 360, al <= ar <= al + 360
void
normalize_angles(float *al, float *ar) {
Expand Down Expand Up @@ -1608,7 +1581,6 @@ clipEllipseNew(

clip_ellipse_state st;
init(&st, a, b, width, start, end);
// debug_clip_tree(st.root, 0);
int32_t X0, Y, X1;
int next_code;
while ((next_code = clip_ellipse_next(&st, &X0, &Y, &X1)) >= 0) {
Expand Down
1 change: 0 additions & 1 deletion src/libImaging/FliDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t byt
break; /* ignored */
default:
/* unknown chunk */
/* printf("unknown FLI/FLC chunk: %d\n", I16(ptr+4)); */
state->errcode = IMAGING_CODEC_UNKNOWN;
return -1;
}
Expand Down
4 changes: 0 additions & 4 deletions src/libImaging/GetBBox.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ ImagingGetExtrema(Imaging im, void *extrema) {
return 1; /* ok */
}

/* static ImagingColorItem* getcolors8(Imaging im, int maxcolors, int* size);*/
static ImagingColorItem *
getcolors32(Imaging im, int maxcolors, int *size);

Expand Down Expand Up @@ -296,9 +295,6 @@ getcolors32(Imaging im, int maxcolors, int *size) {
}
}

/* printf("code_size=%d\n", code_size); */
/* printf("code_poly=%d\n", code_poly); */

if (!code_size) {
return ImagingError_MemoryError(); /* just give up */
}
Expand Down
19 changes: 2 additions & 17 deletions src/libImaging/Mode.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#include "Mode.h"
#include <string.h>

#ifdef NDEBUG
#include <stdio.h>
#include <stdlib.h>
#endif

const ModeData MODES[] = {
[IMAGING_MODE_UNKNOWN] = {""},

Expand All @@ -28,12 +23,7 @@ findModeID(const char *const name) {
return IMAGING_MODE_UNKNOWN;
}
for (size_t i = 0; i < sizeof(MODES) / sizeof(*MODES); i++) {
#ifdef NDEBUG
if (MODES[i].name == NULL) {
fprintf(stderr, "Mode ID %zu is not defined.\n", (size_t)i);
} else
#endif
if (strcmp(MODES[i].name, name) == 0) {
if (strcmp(MODES[i].name, name) == 0) {
return (ModeID)i;
}
}
Expand Down Expand Up @@ -230,12 +220,7 @@ findRawModeID(const char *const name) {
return IMAGING_RAWMODE_UNKNOWN;
}
for (size_t i = 0; i < sizeof(RAWMODES) / sizeof(*RAWMODES); i++) {
#ifdef NDEBUG
if (RAWMODES[i].name == NULL) {
fprintf(stderr, "Rawmode ID %zu is not defined.\n", (size_t)i);
} else
#endif
if (strcmp(RAWMODES[i].name, name) == 0) {
if (strcmp(RAWMODES[i].name, name) == 0) {
return (RawModeID)i;
}
}
Expand Down
Loading
Loading