+ for (i = 0; i < bytes_per_row; i++)
+ {
+ if (count == 0)
+ {
+ if ((value_int = fgetc(file)) == EOF)
+ return FALSE;
+ value = (byte)value_int;
+
+ if ((value & 0xc0) == 0xc0) /* this is a repeat count byte */
+ {
+ count = value & 0x3f; /* extract repeat count from byte */
+ if ((value_int = fgetc(file)) == EOF)
+ return FALSE;
+ value = (byte)value_int;
+ }
+ else
+ count = 1;
+ }
+
+ dst_ptr[i] = value;
+ count--;
+
+ if (pcx_depth == 8)
+ image->rgb.color_used[value] = TRUE;
+ }
+
+ if (pcx_depth <= 4) /* expand planes to 1 byte/pixel */
+ {
+ byte *src_ptr = row_buffer;
+ int plane;
+
+ for (plane = 0; plane < pcx->color_planes; plane++)
+ {
+ int i, j, x = 0;
+
+ for(i = 0; i < pcx->bytes_per_line; i++)
+ {
+ byte value = *src_ptr++;
+
+ for(j = 7; j >= 0; j--)
+ {
+ byte bit = (value >> j) & 1;
+
+ bitmap_ptr[x++] |= bit << plane;
+ }
+ }
+ }
+ }
+ else if (pcx_depth == 24) /* de-interlace planes */
+ {
+ byte *src_ptr = row_buffer;
+ int plane;
+
+ for(plane = 0; plane < pcx->color_planes; plane++)
+ {
+ int x;
+
+ dst_ptr = bitmap_ptr + plane;
+ for(x = 0; x < width; x++)
+ {
+ *dst_ptr = *src_ptr++;
+ dst_ptr += pcx->color_planes;
+ }
+ }
+ }
+
+ bitmap_ptr += image->bytes_per_row;
+ }
+
+ return TRUE;
+}
+
+#if 0