summaryrefslogtreecommitdiff
path: root/devices/gdevpsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'devices/gdevpsd.c')
-rw-r--r--devices/gdevpsd.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/devices/gdevpsd.c b/devices/gdevpsd.c
index f0d362b07..e0344bcd0 100644
--- a/devices/gdevpsd.c
+++ b/devices/gdevpsd.c
@@ -1267,13 +1267,13 @@ psd_write_image_data(psd_write_ctx *xc, gx_device_printer *pdev)
goto cleanup;
/* Print the output planes */
- for (j = 0; j < xc->height; ++j) {
- code = gx_downscaler_get_bits_rectangle(&ds, &params, j);
- if (code < 0)
- goto cleanup;
- for (chan_idx = 0; chan_idx < num_comp; chan_idx++) {
- int data_pos = xc->chnl_to_position[chan_idx];
- if (data_pos >= 0) {
+ for (chan_idx = 0; chan_idx < num_comp; chan_idx++) {
+ int data_pos = xc->chnl_to_position[chan_idx];
+ if (data_pos >= 0) {
+ for (j = 0; j < xc->height; ++j) {
+ code = gx_downscaler_get_bits_rectangle(&ds, &params, j);
+ if (code < 0)
+ goto cleanup;
unpacked = params.data[data_pos];
@@ -1289,15 +1289,14 @@ psd_write_image_data(psd_write_ctx *xc, gx_device_printer *pdev)
}
}
psd_write(xc, sep_line, octets_per_line);
- } else if (chan_idx < NUM_CMYK_COMPONENTS) {
+ }
+ } else {
+ if (chan_idx < NUM_CMYK_COMPONENTS) {
/* Write empty process color in the area */
memset(sep_line,255,octets_per_line);
psd_write(xc, sep_line, octets_per_line);
}
- fseek(xc->f, (xc->height-1) * octets_per_line, SEEK_CUR);
}
- if (j < xc->height-1)
- fseek(xc->f, -(num_comp * xc->height - 1) * octets_per_line, SEEK_CUR);
}
cleanup: