@@ -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+
2831static void
2932im_point_8_8 (Imaging imOut , Imaging imIn , im_point_context * context ) {
3033 /* 8-bit source, 8-bit destination */
@@ -53,6 +56,8 @@ im_point_2x8_2x8(Imaging imOut, Imaging imIn, im_point_context *context) {
5356 UINT8 * restrict out = (UINT8 * )imOut -> image [y ];
5457 for (int x = 0 ; x < xsize ; x ++ ) {
5558 out [0 ] = table [in [0 ]];
59+ out [1 ] = 0 ;
60+ out [2 ] = 0 ;
5661 out [3 ] = table [in [3 ] + 256 ];
5762 in += 4 ;
5863 out += 4 ;
@@ -74,6 +79,7 @@ im_point_3x8_3x8(Imaging imOut, Imaging imIn, im_point_context *context) {
7479 out [0 ] = table [in [0 ]];
7580 out [1 ] = table [in [1 ] + 256 ];
7681 out [2 ] = table [in [2 ] + 512 ];
82+ out [3 ] = 0 ;
7783 in += 4 ;
7884 out += 4 ;
7985 }
@@ -164,7 +170,7 @@ ImagingPoint(Imaging imIn, ModeID mode, const void *table) {
164170 goto mode_mismatch ;
165171 }
166172
167- imOut = ImagingNew (mode , imIn -> xsize , imIn -> ysize );
173+ imOut = ImagingNewDirty (mode , imIn -> xsize , imIn -> ysize );
168174 if (!imOut ) {
169175 return NULL ;
170176 }
@@ -229,7 +235,7 @@ ImagingPointTransform(Imaging imIn, double scale, double offset) {
229235 // Invariant over the loops.
230236 int xsize = imIn -> xsize , ysize = imIn -> ysize ;
231237
232- imOut = ImagingNew (imIn -> mode , xsize , ysize );
238+ imOut = ImagingNewDirty (imIn -> mode , xsize , ysize );
233239 if (!imOut ) {
234240 return NULL ;
235241 }
0 commit comments