Skip to content

Commit 81444fe

Browse files
committed
Point: remove function-pointer redirection
1 parent 84b76c0 commit 81444fe

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
@@ -152,7 +152,6 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
152152
ImagingSectionCookie cookie;
153153
Imaging imOut;
154154
im_point_context context;
155-
void (*point)(Imaging imIn, Imaging imOut, im_point_context *context);
156155

157156
if (!imIn) {
158157
return (Imaging)ImagingError_ModeError();
@@ -175,41 +174,37 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
175174
return NULL;
176175
}
177176

178-
/* find appropriate handler */
177+
ImagingCopyPalette(imOut, imIn);
178+
179+
ImagingSectionEnter(&cookie);
180+
context.table = table;
181+
179182
if (imIn->type == IMAGING_TYPE_UINT8) {
180183
if (imIn->bands == imOut->bands && imIn->type == imOut->type) {
181184
switch (imIn->bands) {
182185
case 1:
183-
point = im_point_8_8;
186+
im_point_8_8(imOut, imIn, &context);
184187
break;
185188
case 2:
186-
point = im_point_2x8_2x8;
189+
im_point_2x8_2x8(imOut, imIn, &context);
187190
break;
188191
case 3:
189-
point = im_point_3x8_3x8;
192+
im_point_3x8_3x8(imOut, imIn, &context);
190193
break;
191194
case 4:
192-
point = im_point_4x8_4x8;
195+
im_point_4x8_4x8(imOut, imIn, &context);
193196
break;
194197
default:
195198
/* this cannot really happen */
196-
point = im_point_8_8;
199+
im_point_8_8(imOut, imIn, &context);
197200
break;
198201
}
199202
} else {
200-
point = im_point_8_32;
203+
im_point_8_32(imOut, imIn, &context);
201204
}
202205
} else {
203-
point = im_point_32_8;
206+
im_point_32_8(imOut, imIn, &context);
204207
}
205-
206-
ImagingCopyPalette(imOut, imIn);
207-
208-
ImagingSectionEnter(&cookie);
209-
210-
context.table = table;
211-
point(imOut, imIn, &context);
212-
213208
ImagingSectionLeave(&cookie);
214209

215210
return imOut;

0 commit comments

Comments
 (0)