Skip to content

Commit 634047d

Browse files
committed
Point: remove function-pointer redirection
1 parent cf10dcc commit 634047d

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

src/libImaging/Point.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
170170
ImagingSectionCookie cookie;
171171
Imaging imOut;
172172
im_point_context context;
173-
void (*point)(Imaging imIn, Imaging imOut, im_point_context *context);
174173

175174
if (!imIn) {
176175
return (Imaging)ImagingError_ModeError();
@@ -193,41 +192,37 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
193192
return NULL;
194193
}
195194

196-
/* find appropriate handler */
195+
ImagingCopyPalette(imOut, imIn);
196+
197+
ImagingSectionEnter(&cookie);
198+
context.table = table;
199+
197200
if (imIn->type == IMAGING_TYPE_UINT8) {
198201
if (imIn->bands == imOut->bands && imIn->type == imOut->type) {
199202
switch (imIn->bands) {
200203
case 1:
201-
point = im_point_8_8;
204+
im_point_8_8(imOut, imIn, &context);
202205
break;
203206
case 2:
204-
point = im_point_2x8_2x8;
207+
im_point_2x8_2x8(imOut, imIn, &context);
205208
break;
206209
case 3:
207-
point = im_point_3x8_3x8;
210+
im_point_3x8_3x8(imOut, imIn, &context);
208211
break;
209212
case 4:
210-
point = im_point_4x8_4x8;
213+
im_point_4x8_4x8(imOut, imIn, &context);
211214
break;
212215
default:
213216
/* this cannot really happen */
214-
point = im_point_8_8;
217+
im_point_8_8(imOut, imIn, &context);
215218
break;
216219
}
217220
} else {
218-
point = im_point_8_32;
221+
im_point_8_32(imOut, imIn, &context);
219222
}
220223
} else {
221-
point = im_point_32_8;
224+
im_point_32_8(imOut, imIn, &context);
222225
}
223-
224-
ImagingCopyPalette(imOut, imIn);
225-
226-
ImagingSectionEnter(&cookie);
227-
228-
context.table = table;
229-
point(imOut, imIn, &context);
230-
231226
ImagingSectionLeave(&cookie);
232227

233228
return imOut;

0 commit comments

Comments
 (0)