rem: if (rawcount == 128 || nread == width || (pixel == nextpixel && rawcount > 0)) { result = copy_raw_packet(ptga, prawbuf, rawcount, fromspace, pmap, bitsBytesPerPixel);
add: if (nread == width) {      if (rawcount == 128) { result = copy_raw_packet(ptga, prawbuf, rawcount, fromspace, pmap, bitsBytesPerPixel);  ptga += result; bytescopied += result; praw = prawbuf; rawcount = 0; }
context: pix_bits_to_tgarle(uint8 *pbits, uint8 *ptga, color_space fromspace,	uint16 width, const color_map *pmap, int32 bitsBytesPerPixel){	if (width == 0)		return B_ERROR;		uint32 pixel = 0, lastpixel = 0, nextpixel = 0;	uint16 nread = 0;	status_t result, bytescopied = 0;	uint8 *prawbuf, *praw;	prawbuf = new uint8[bitsBytesPerPixel * 128];	praw = prawbuf;	if (!prawbuf)		return B_ERROR;		uint8 rlecount = 1, rawcount = 0;		memcpy(&pixel, pbits, bitsBytesPerPixel);	pbits += bitsBytesPerPixel;		while (nread < width) {			if (nread < width - 1) {			memcpy(&nextpixel, pbits, bitsBytesPerPixel);			pbits += bitsBytesPerPixel;		}		nread++;					if (nread > 1 && lastpixel == pixel) {			rlecount++;						if (rlecount == 128 || nread == width || pixel != nextpixel) {				result = copy_rle_packet(ptga, pixel, rlecount,					fromspace, pmap, bitsBytesPerPixel);				ptga += result;				bytescopied += result;				rlecount = 1;			}					} else {			if ((nread < width && pixel != nextpixel) || nread == width) {				rawcount++;				memcpy(praw, &pixel, bitsBytesPerPixel);				praw += bitsBytesPerPixel;			}						if (rawcount == 128 || nread == width || (pixel == nextpixel && rawcount > 0)) {				result = copy_raw_packet(ptga,					prawbuf, rawcount, fromspace, pmap,					bitsBytesPerPixel);								ptga += result;				bytescopied += result;				rawcount = 0;				praw = prawbuf;			}		}			lastpixel = pixel;		pixel = nextpixel;	}		delete[] prawbuf;	prawbuf = NULL;		return bytescopied;}