Skip to content
Draft
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
7 changes: 0 additions & 7 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ _dealloc(ImagingObject *imagep) {
#ifdef VERBOSE
printf("imaging %p deleted\n", imagep);
#endif

if (imagep->access) {
ImagingAccessDelete(imagep->image, imagep->access);
}
ImagingDelete(imagep->image);
PyObject_Del(imagep);
}
Expand Down Expand Up @@ -2087,9 +2083,6 @@ im_setmode(ImagingObject *self, PyObject *args) {
}
}

if (self->access) {
ImagingAccessDelete(im, self->access);
}
self->access = ImagingAccessNew(im);

Py_RETURN_NONE;
Expand Down
3 changes: 0 additions & 3 deletions src/libImaging/Access.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,3 @@ ImagingAccessNew(const Imaging im) {
}
return NULL;
}

void
_ImagingAccessDelete(Imaging im, ImagingAccess access) {}
12 changes: 6 additions & 6 deletions src/libImaging/Arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ReleaseExportedSchema(struct ArrowSchema *array) {
array->release = NULL;
}

char *
static char *
image_band_json(Imaging im) {
char *format = "{\"bands\": [\"%s\", \"%s\", \"%s\", \"%s\"]}";
char *json;
Expand Down Expand Up @@ -89,7 +89,7 @@ image_band_json(Imaging im) {
return json;
}

char *
static char *
single_band_json(Imaging im) {
char *format = "{\"bands\": [\"%s\"]}";
char *json;
Expand All @@ -110,7 +110,7 @@ single_band_json(Imaging im) {
return json;
}

char *
static char *
assemble_metadata(const char *band_json) {
/* format is
int32: number of key/value pairs (noted N below)
Expand Down Expand Up @@ -153,7 +153,7 @@ assemble_metadata(const char *band_json) {
return buf;
}

int
static int
export_named_type(struct ArrowSchema *schema, char *format, const char *name) {
char *formatp;
char *namep;
Expand Down Expand Up @@ -283,7 +283,7 @@ release_const_array(struct ArrowArray *array) {
array->release = NULL;
}

int
static int
export_single_channel_array(Imaging im, struct ArrowArray *array) {
int length = im->xsize * im->ysize;

Expand Down Expand Up @@ -330,7 +330,7 @@ export_single_channel_array(Imaging im, struct ArrowArray *array) {
return 0;
}

int
static int
export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
int length = im->xsize * im->ysize;

Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/BoxBlur.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void static inline ImagingLineBoxBlur8(
#undef SAVE
}

Imaging
static Imaging
ImagingHorizontalBoxBlur(Imaging imOut, Imaging imIn, float floatRadius) {
ImagingSectionCookie cookie;

Expand Down
61 changes: 18 additions & 43 deletions src/libImaging/Draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,9 @@ typedef struct {
void (*line)(Imaging im, int x0, int y0, int x1, int y1, int ink);
} DRAW;

DRAW draw8 = {point8, hline8, line8};
DRAW draw32 = {point32, hline32, line32};
DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba};
static DRAW draw8 = {point8, hline8, line8};
static DRAW draw32 = {point32, hline32, line32};
static DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba};

/* -------------------------------------------------------------------- */
/* Interface */
Expand Down Expand Up @@ -933,7 +933,7 @@ typedef struct {
int8_t finished;
} quarter_state;

void
static void
quarter_init(quarter_state *s, int32_t a, int32_t b) {
if (a < 0 || b < 0) {
s->finished = 1;
Expand All @@ -953,12 +953,12 @@ quarter_init(quarter_state *s, int32_t a, int32_t b) {

// deviation of the point from ellipse curve, basically a substitution
// of the point into the ellipse equation
int64_t
static int64_t
quarter_delta(quarter_state *s, int64_t x, int64_t y) {
return llabs(s->a2 * y * y + s->b2 * x * x - s->a2b2);
}

int8_t
static int8_t
quarter_next(quarter_state *s, int32_t *ret_x, int32_t *ret_y) {
if (s->finished) {
return -1;
Expand Down Expand Up @@ -1009,7 +1009,7 @@ typedef struct {
int8_t leftmost;
} ellipse_state;

void
static void
ellipse_init(ellipse_state *s, int32_t a, int32_t b, int32_t w) {
s->bufcnt = 0;
s->leftmost = a % 2;
Expand All @@ -1023,7 +1023,7 @@ ellipse_init(ellipse_state *s, int32_t a, int32_t b, int32_t w) {
}
}

int8_t
static int8_t
ellipse_next(ellipse_state *s, int32_t *ret_x0, int32_t *ret_y, int32_t *ret_x1) {
if (s->bufcnt == 0) {
if (s->finished) {
Expand Down Expand Up @@ -1106,7 +1106,7 @@ typedef struct event_list {
} event_list;

// Mirrors all the clipping nodes of the tree relative to the y = x line.
void
static void
clip_tree_transpose(clip_node *root) {
if (root != NULL) {
if (root->type == CT_CLIP) {
Expand All @@ -1123,7 +1123,7 @@ clip_tree_transpose(clip_node *root) {
// non-intersecting segments sorted by X coordinate.
// Combining nodes (AND, OR) may also accept sequences for intersecting
// segments, i.e. something like correct bracket sequences.
int
static int
clip_tree_do_clip(
clip_node *root, int32_t x0, int32_t y, int32_t x1, event_list **ret
) {
Expand Down Expand Up @@ -1266,33 +1266,8 @@ 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
static void
normalize_angles(float *al, float *ar) {
if (*ar - *al >= 360) {
*al = 0;
Expand All @@ -1304,7 +1279,7 @@ normalize_angles(float *al, float *ar) {
}

// An arc with caps orthogonal to the ellipse curve.
void
static void
arc_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
if (a < b) {
// transpose the coordinate system
Expand Down Expand Up @@ -1374,7 +1349,7 @@ arc_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float
}

// A chord line.
void
static void
chord_line_init(
clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar
) {
Expand Down Expand Up @@ -1402,7 +1377,7 @@ chord_line_init(
}

// Pie side.
void
static void
pie_side_init(
clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float _
) {
Expand Down Expand Up @@ -1447,7 +1422,7 @@ pie_side_init(
}

// A chord.
void
static void
chord_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
ellipse_init(&s->st, a, b, w);

Expand All @@ -1466,7 +1441,7 @@ chord_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, flo
}

// A pie. Can also be used to draw an arc with ugly sharp caps.
void
static void
pie_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
ellipse_init(&s->st, a, b, w);

Expand Down Expand Up @@ -1510,7 +1485,7 @@ pie_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float
}
}

void
static void
clip_ellipse_free(clip_ellipse_state *s) {
while (s->head != NULL) {
event_list *t = s->head;
Expand All @@ -1519,7 +1494,7 @@ clip_ellipse_free(clip_ellipse_state *s) {
}
}

int8_t
static int8_t
clip_ellipse_next(
clip_ellipse_state *s, int32_t *ret_x0, int32_t *ret_y, int32_t *ret_x1
) {
Expand Down
1 change: 0 additions & 1 deletion src/libImaging/Fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ ImagingFill(Imaging im, const void *colour) {
access->put_pixel(im, x, y, colour);
}
}
ImagingAccessDelete(im, access);
} else {
/* wipe the image */
for (int y = 0; y < ysize; y++) {
Expand Down
1 change: 1 addition & 0 deletions src/libImaging/Filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ ImagingExpand(Imaging imIn, int margin) {
return imOut;
}

// Deliberately not static: looks like GCC inlining this may be slower.
float
kernel_i16(int size, UINT8 *in0, int x, const float *kernel, int bigendian) {
int i;
Expand Down
4 changes: 2 additions & 2 deletions src/libImaging/Geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ getfilter(Imaging im, int filterid) {

/* transformation engines */

Imaging
static Imaging
ImagingGenericTransform(
Imaging imOut,
Imaging imIn,
Expand Down Expand Up @@ -1006,7 +1006,7 @@ affine_fixed(
return imOut;
}

Imaging
static Imaging
ImagingTransformAffine(
Imaging imOut,
Imaging imIn,
Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/Histo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ImagingHistogramDelete(ImagingHistogram h) {
}
}

ImagingHistogram
static ImagingHistogram
ImagingHistogramNew(Imaging im) {
ImagingHistogram h;

Expand Down
3 changes: 0 additions & 3 deletions src/libImaging/Imaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ ImagingHistogramDelete(ImagingHistogram histogram);

extern ImagingAccess
ImagingAccessNew(Imaging im);
extern void
_ImagingAccessDelete(Imaging im, ImagingAccess access);
#define ImagingAccessDelete(im, access) /* nop, for now */

extern ImagingPalette
ImagingPaletteNew(ModeID mode);
Expand Down
3 changes: 1 addition & 2 deletions src/libImaging/JpegDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
}
}

GLOBAL(void)
jpeg_buffer_src(j_decompress_ptr cinfo, JPEGSOURCE *source) {
static GLOBAL(void) jpeg_buffer_src(j_decompress_ptr cinfo, JPEGSOURCE *source) {
cinfo->src = (void *)source;

/* Prepare for suspending reader */
Expand Down
5 changes: 3 additions & 2 deletions src/libImaging/JpegEncode.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ empty_output_buffer(j_compress_ptr cinfo) {
return FALSE;
}

GLOBAL(void)
jpeg_buffer_dest(j_compress_ptr cinfo, JPEGDESTINATION *destination) {
static GLOBAL(void) jpeg_buffer_dest(
j_compress_ptr cinfo, JPEGDESTINATION *destination
) {
cinfo->dest = (void *)destination;

destination->pub.init_destination = stub;
Expand Down
4 changes: 2 additions & 2 deletions src/libImaging/Mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <stdlib.h>
#endif

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

[IMAGING_MODE_1] = {"1"}, [IMAGING_MODE_CMYK] = {"CMYK"},
Expand Down Expand Up @@ -48,7 +48,7 @@ getModeData(const ModeID id) {
return &MODES[id];
}

const RawModeData RAWMODES[] = {
static const RawModeData RAWMODES[] = {
[IMAGING_RAWMODE_UNKNOWN] = {""},

[IMAGING_RAWMODE_1] = {"1"},
Expand Down
Loading
Loading