Skip to content

Commit 0f02dcf

Browse files
committed
Point: use ImagingNewDirty
1 parent 1a291c3 commit 0f02dcf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/libImaging/Point.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ typedef struct {
2525
const void *table;
2626
} im_point_context;
2727

28+
// Note: all point handlers must fill the entirety of `imOut`,
29+
// as it is allocated dirty by `ImagingPoint`.
30+
2831
/**
2932
* Contract: imIn is read-only and imOut must be a distinct image.
3033
*/
@@ -59,6 +62,8 @@ im_point_2x8_2x8(Imaging imOut, Imaging imIn, im_point_context *context) {
5962
UINT8 *restrict out = (UINT8 *)imOut->image[y];
6063
for (int x = 0; x < xsize; x++) {
6164
out[0] = table[in[0]];
65+
out[1] = 0;
66+
out[2] = 0;
6267
out[3] = table[in[3] + 256];
6368
in += 4;
6469
out += 4;
@@ -83,6 +88,7 @@ im_point_3x8_3x8(Imaging imOut, Imaging imIn, im_point_context *context) {
8388
out[0] = table[in[0]];
8489
out[1] = table[in[1] + 256];
8590
out[2] = table[in[2] + 512];
91+
out[3] = 0;
8692
in += 4;
8793
out += 4;
8894
}
@@ -182,7 +188,7 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
182188
goto mode_mismatch;
183189
}
184190

185-
imOut = ImagingNew(mode, imIn->xsize, imIn->ysize);
191+
imOut = ImagingNewDirty(mode, imIn->xsize, imIn->ysize);
186192
if (!imOut) {
187193
return NULL;
188194
}
@@ -253,7 +259,7 @@ ImagingPointTransform(Imaging imIn, double scale, double offset) {
253259
// Invariant over the loops.
254260
int xsize = imIn->xsize, ysize = imIn->ysize;
255261

256-
imOut = ImagingNew(imIn->mode, xsize, ysize);
262+
imOut = ImagingNewDirty(imIn->mode, xsize, ysize);
257263
if (!imOut) {
258264
return NULL;
259265
}

0 commit comments

Comments
 (0)