png_set_expand( png_ptr );
png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER );
- image->Create( (int)width, (int)height );
+ image->Create((int)width, (int)height, false /* no need to init pixels */);
if (!image->Ok())
goto error;
data[(x << 2) + 0] = *ptr++;
data[(x << 2) + 1] = *ptr++;
data[(x << 2) + 2] = *ptr++;
- if (( !image->HasMask() ) || \
+ if ( image->HasAlpha() )
+ {
+ data[(x << 2) + 3] = image->GetAlpha(x, y);
+ }
+ else if (( !image->HasMask() ) || \
(data[(x << 2) + 0] != image->GetMaskRed()) || \
(data[(x << 2) + 1] != image->GetMaskGreen()) || \
(data[(x << 2) + 2] != image->GetMaskBlue()))