Buggy code:
public final class Image extends Resource implements Drawable { public int type ; public int pixmap ; public int mask ; int surface ; int surfaceData ; int transparentPixel = - 1 ; GC memGC ; byte [ ] alphaData ; int alpha = - 1 ; int width = - 1 ; int height = - 1 ; static final int DEFAULT_SCANLINE_PAD = 4 ; Image ( ) { } public Image ( Device device , int width , int height ) { } public Image ( Device device , Image srcImage , int flag ) { } public Image ( Device device , Rectangle bounds ) { } public Image ( Device device , ImageData data ) { } public Image ( Device device , ImageData source , ImageData mask ) { } public Image ( Device device , InputStream stream ) { } public Image ( Device device , String filename ) { } void createMask ( ) { } int createMask ( ImageData image , boolean copy ) { } void createSurface ( ) { if ( ( surface ) != 0 ) return ; if ( ( transparentPixel ) != ( - 1 ) ) createMask ( ) ; int [ ] w = new int [ 1 ] ; int [ ] h = new int [ 1 ] ; OS . gdk_drawable_get_size ( pixmap , w , h ) ; int width = w [ 0 ] ; int height = h [ 0 ] ; if ( ( ( ( mask ) != 0 ) || ( ( alpha ) != ( - 1 ) ) ) || ( ( alphaData ) != null ) ) { int pixbuf = OS . gdk_pixbuf_new ( GDK_COLORSPACE_RGB , true , 8 , width , height ) ; if ( pixbuf == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; int colormap = OS . gdk_colormap_get_system ( ) ; OS . gdk_pixbuf_get_from_drawable ( pixbuf , pixmap , colormap , 0 , 0 , 0 , 0 , width , height ) ; int stride = OS . gdk_pixbuf_get_rowstride ( pixbuf ) ; int pixels = OS . gdk_pixbuf_get_pixels ( pixbuf ) ; byte [ ] line = new byte [ stride ] ; if ( ( ( mask ) != 0 ) && ( ( OS . gdk_drawable_get_depth ( mask ) ) == 1 ) ) { int maskPixbuf = OS . gdk_pixbuf_new ( GDK_COLORSPACE_RGB , false , 8 , width , height ) ; if ( maskPixbuf == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; OS . gdk_pixbuf_get_from_drawable ( maskPixbuf , mask , 0 , 0 , 0 , 0 , 0 , width , height ) ; int maskStride = OS . gdk_pixbuf_get_rowstride ( maskPixbuf ) ; int maskPixels = OS . gdk_pixbuf_get_pixels ( maskPixbuf ) ; byte [ ] maskLine = new byte [ maskStride ] ; int offset = pixels ; int maskOffset = maskPixels ; for ( int y = 0 ; y < height ; y ++ ) { OS . memmove ( line , offset , stride ) ; OS . memmove ( maskLine , maskOffset , maskStride ) ; for ( int x = 0 , offset1 = 0 ; x < width ; x ++ , offset1 += 4 ) { if ( ( maskLine [ ( x * 3 ) ] ) == 0 ) { <START_BUG> line [ ( offset1 + 3 ) ] = 0 ; <END_BUG> } byte temp = line [ offset1 ] ; line [ offset1 ] = line [ ( offset1 + 2 ) ] ; line [ ( offset1 + 2 ) ] = temp ; } OS . memmove ( offset , line , stride ) ; offset += stride ; maskOffset += maskStride ; } OS . g_object_unref ( maskPixbuf ) ; } else if ( ( alpha ) != ( - 1 ) ) { int offset = pixels ; for ( int y = 0 ; y < height ; y ++ ) { OS . memmove ( line , offset , stride ) ; for ( int x = 0 , offset1 = 0 ; x < width ; x ++ , offset1 += 4 ) { line [ ( offset1 + 3 ) ] = ( ( byte ) ( alpha ) ) ; int r = ( ( ( line [ ( offset1 + 0 ) ] ) & 255 ) * ( alpha ) ) + 128 ; r = ( r + ( r > > 8 ) ) > > 8 ; int g = ( ( ( line [ ( offset1 + 1 ) ] ) & 255 ) * ( alpha ) ) + 128 ; g = ( g + ( g > > 8 ) ) > > 8 ; int b = ( ( ( line [ ( offset1 + 2 ) ] ) & 255 ) * ( alpha ) ) + 128 ; b = ( b + ( b > > 8 ) ) > > 8 ; line [ ( offset1 + 0 ) ] = ( ( byte ) ( b ) ) ; line [ ( offset1 + 1 ) ] = ( ( byte ) ( g ) ) ; line [ ( offset1 + 2 ) ] = ( ( byte ) ( r ) ) ; } OS . memmove ( offset , line , stride ) ; offset += stride ; } } else if ( ( alphaData ) != null ) { int offset = pixels ; for ( int y = 0 ; y < ( h [ 0 ] ) ; y ++ ) { OS . memmove ( line , offset , stride ) ; for ( int x = 0 , offset1 = 0 ; x < width ;

Fix:
line [ ( offset1 + 0 ) ] = line [ ( offset1 + 1 ) ] = line [ ( offset1 + 2 ) ] = line [ ( offset1 + 3 ) ] = 0 ;