data_num=0;
index=0;

while( data_num<width*height*4 ) {
	dist=compressed_data[index];
	index++;

	if( dist<0x80) {
		for(i=0; i<dist+1; i++) {
			pixel_data[data_num+2]=compressed_data[index+0];
			pixel_data[data_num+1]=compressed_data[index+1];
			pixel_data[data_num+0]=compressed_data[index+2];
			pixel_data[data_num+3]=compressed_data[index+3];

			data_num+=4;
			index+=4;
		}
	}
	else {
		for(i=0x80; i<dist+1; i++) {
			pixel_data[data_num+2]=compressed_data[index+0];
			pixel_data[data_num+1]=compressed_data[index+1];
			pixel_data[data_num+0]=compressed_data[index+2];
			pixel_data[data_num+3]=compressed_data[index+3];

			data_num+=4;
		}
		index+=4;
	}
}