diff -up ghostscript-8.70/cups/gdevcups.c.gdevcups-y-axis ghostscript-8.70/cups/gdevcups.c --- ghostscript-8.70/cups/gdevcups.c.gdevcups-y-axis 2010-01-25 08:34:15.197084192 +0000 +++ ghostscript-8.70/cups/gdevcups.c 2010-01-25 08:34:21.603208913 +0000 @@ -605,8 +605,6 @@ private void cups_get_matrix(gx_device *pdev, /* I - Device info */ gs_matrix *pmat) /* O - Physical transform matrix */ { - ppd_attr_t *backside = NULL; - dprintf2("DEBUG2: cups_get_matrix(%p, %p)\n", pdev, pmat); /* @@ -620,119 +618,25 @@ cups_get_matrix(gx_device *pdev, /* I - * Set the transform matrix... */ - dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); - dprintf1("DEBUG2: cups->page = %d\n", cups->page); - - if (cupsPPD) - { - backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); - dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); - if (backside) { - dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); - cupsPPD->flip_duplex = 0; - } - dprintf1("DEBUG2: cupsPPD->flip_duplex = %d\n", cupsPPD->flip_duplex); - } - if (cups->landscape) { /* * Do landscape orientation... */ - - if (cups->header.Duplex && cupsPPD && - (cups->header.Tumble && - (backside && !strcasecmp(backside->value, "Flipped"))) && - !(cups->page & 1)) - { - pmat->xx = 0.0; - pmat->xy = (float)cups->header.HWResolution[1] / 72.0; - pmat->yx = (float)cups->header.HWResolution[0] / 72.0; - pmat->yy = 0.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[1] / 72.0; - pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[0] / 72.0; - } - else if (cups->header.Duplex && cupsPPD && - (!cups->header.Tumble && - (backside && !strcasecmp(backside->value, "Flipped"))) && - !(cups->page & 1)) - { - pmat->xx = 0.0; - pmat->xy = -(float)cups->header.HWResolution[1] / 72.0; - pmat->yx = (float)cups->header.HWResolution[0] / 72.0; - pmat->yy = 0.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[1] / 72.0; - pmat->ty = (float)cups->header.HWResolution[1] * - ((float)cups->header.PageSize[0] - pdev->HWMargins[2]) / 72.0; - } - else if (cups->header.Duplex && cupsPPD && - ((!cups->header.Tumble && - (cupsPPD->flip_duplex || - (backside && !strcasecmp(backside->value, "Rotated")))) || - (cups->header.Tumble && - (backside && !strcasecmp(backside->value, "ManualTumble")))) && - !(cups->page & 1)) - { - pmat->xx = 0.0; - pmat->xy = -(float)cups->header.HWResolution[1] / 72.0; - pmat->yx = (float)cups->header.HWResolution[0] / 72.0; - pmat->yy = 0.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[1] / 72.0; - pmat->ty = (float)cups->header.HWResolution[1] * - ((float)cups->header.PageSize[0] - pdev->HWMargins[2]) / 72.0; - } - else - { - pmat->xx = 0.0; - pmat->xy = (float)cups->header.HWResolution[1] / 72.0; - pmat->yx = (float)cups->header.HWResolution[0] / 72.0; - pmat->yy = 0.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[1] / 72.0; - pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[0] / 72.0; - } - } - else if (cups->header.Duplex && cupsPPD && - (cups->header.Tumble && - (backside && !strcasecmp(backside->value, "Flipped"))) && - !(cups->page & 1)) - { - pmat->xx = (float)cups->header.HWResolution[0] / 72.0; - pmat->xy = 0.0; - pmat->yx = 0.0; - pmat->yy = -(float)cups->header.HWResolution[1] / 72.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[0] / 72.0; - pmat->ty = (float)cups->header.HWResolution[1] * - ((float)cups->header.PageSize[1] - pdev->HWMargins[3]) / 72.0; - } - else if (cups->header.Duplex && cupsPPD && - (!cups->header.Tumble && - (backside && !strcasecmp(backside->value, "Flipped"))) && - !(cups->page & 1)) - { - pmat->xx = (float)cups->header.HWResolution[0] / 72.0; - pmat->xy = 0.0; - pmat->yx = 0.0; - pmat->yy = (float)cups->header.HWResolution[1] / 72.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[0] / 72.0; - pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[1] / 72.0; - } - else if (cups->header.Duplex && cupsPPD && - ((!cups->header.Tumble && - (cupsPPD->flip_duplex || - (backside && !strcasecmp(backside->value, "Rotated")))) || - (cups->header.Tumble && - (backside && !strcasecmp(backside->value, "ManualTumble")))) && - !(cups->page & 1)) - { - pmat->xx = (float)cups->header.HWResolution[0] / 72.0; - pmat->xy = 0.0; - pmat->yx = 0.0; - pmat->yy = (float)cups->header.HWResolution[1] / 72.0; - pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[0] / 72.0; - pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[1] / 72.0; + dprintf("DEBUG2: Landscape matrix: XX=0 XY=+1 YX=+1 YY=0\n"); + pmat->xx = 0.0; + pmat->xy = (float)cups->header.HWResolution[1] / 72.0; + pmat->yx = (float)cups->header.HWResolution[0] / 72.0; + pmat->yy = 0.0; + pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[1] / 72.0; + pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[0] / 72.0; } else { + /* + * Do portrait orientation... + */ + dprintf("DEBUG2: Portrait matrix: XX=+1 XY=0 YX=0 YY=-1\n"); pmat->xx = (float)cups->header.HWResolution[0] / 72.0; pmat->xy = 0.0; pmat->yx = 0.0; @@ -2792,13 +2696,16 @@ cups_put_params(gx_device *pdev, /* int color_set; /* Were the color attrs set? */ gdev_prn_space_params sp; /* Space parameter data */ int width, /* New width of page */ - height; /* New height of page */ + height; /* New height of page */ + static int width_old = 0, /* Previous width */ + height_old = 0; /* Previous height */ ppd_attr_t *backside = NULL, *backsiderequiresflippedmargins = NULL; float swap; int xflip = 0, yflip = 0; int found = 0; + static int lastpage = 0; dprintf2("DEBUG2: cups_put_params(%p, %p)\n", pdev, plist); @@ -2897,6 +2804,14 @@ cups_put_params(gx_device *pdev, /* margins_set = param_read_float_array(plist, "Margins", &arrayval) == 0; color_set = param_read_int(plist, "cupsColorSpace", &intval) == 0 || param_read_int(plist, "cupsBitsPerColor", &intval) == 0; + /* We also recompute page size and margins if we simply get onto a new + page without necessarily having a page size change in the PostScript + code, as for some printers margins have to flipped on the back sides of + the sheets (even pages) when printing duplex */ + if (cups->page != lastpage) { + size_set = 1; + lastpage = cups->page; + } stringoption(MediaClass, "MediaClass") stringoption(MediaColor, "MediaColor") @@ -3011,6 +2926,7 @@ cups_put_params(gx_device *pdev, /* if (cupsPPD != NULL) { dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); + dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); dprintf1("DEBUG2: cups->page = %d\n", cups->page); dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); @@ -3034,10 +2950,13 @@ cups_put_params(gx_device *pdev, /* { xflip = 1; if (backsiderequiresflippedmargins && - !strcasecmp(backsiderequiresflippedmargins->value, "False")) + !strcasecmp(backsiderequiresflippedmargins->value, "False")) { + dprintf("DEBUG2: (1) Flip: X=1 Y=0\n"); yflip = 0; - else + } else { + dprintf("DEBUG2: (1) Flip: X=1 Y=1\n"); yflip = 1; + } } else if (cups->header.Duplex && (!cups->header.Tumble && @@ -3046,10 +2965,13 @@ cups_put_params(gx_device *pdev, /* { xflip = 0; if (backsiderequiresflippedmargins && - !strcasecmp(backsiderequiresflippedmargins->value, "False")) + !strcasecmp(backsiderequiresflippedmargins->value, "False")) { + dprintf("DEBUG2: (2) Flip: X=0 Y=1\n"); yflip = 1; - else + } else { + dprintf("DEBUG2: (2) Flip: X=0 Y=0\n"); yflip = 0; + } } else if (cups->header.Duplex && ((!cups->header.Tumble && @@ -3061,13 +2983,17 @@ cups_put_params(gx_device *pdev, /* { xflip = 1; if (backsiderequiresflippedmargins && - !strcasecmp(backsiderequiresflippedmargins->value, "True")) + !strcasecmp(backsiderequiresflippedmargins->value, "True")) { + dprintf("DEBUG2: (3) Flip: X=1 Y=0\n"); yflip = 0; - else + } else { + dprintf("DEBUG2: (3) Flip: X=1 Y=1\n"); yflip = 1; + } } else { + dprintf("DEBUG2: (4) Flip: X=0 Y=0\n"); xflip = 0; yflip = 0; } @@ -3104,9 +3030,20 @@ cups_put_params(gx_device *pdev, /* ((strlen(cups->header.cupsPageSizeName) == 0) || (strcasecmp(cups->header.cupsPageSizeName, size->name) == 0)) && #endif + /* We check whether all 4 margins match with the margin info + of the page size in the PPD. Here we check also for swapped + left/right and top/bottom margins as the cups->HWMargins + info can be from the previous page and there the margins + can be swapped due to duplex printing requirements */ (!margins_set || - (fabs(cups->HWMargins[0] - size->left) < 1.0 && - fabs(cups->HWMargins[1] - size->bottom) < 1.0))) + (((fabs(cups->HWMargins[0] - size->left) < 1.0 && + fabs(cups->HWMargins[2] - size->width + size->right) < 1.0) || + (fabs(cups->HWMargins[0] - size->width + size->right) < 1.0 && + fabs(cups->HWMargins[2] - size->left) < 1.0)) && + ((fabs(cups->HWMargins[1] - size->bottom) < 1.0 && + fabs(cups->HWMargins[3] - size->length + size->top) < 1.0) || + (fabs(cups->HWMargins[1] - size->length + size->top) < 1.0 && + fabs(cups->HWMargins[3] - size->bottom) < 1.0))))) break; if (i > 0) @@ -3148,9 +3085,20 @@ cups_put_params(gx_device *pdev, /* ((strlen(cups->header.cupsPageSizeName) == 0) || (strcasecmp(cups->header.cupsPageSizeName, size->name) == 0)) && #endif + /* We check whether all 4 margins match with the margin info + of the page size in the PPD. Here we check also for swapped + left/right and top/bottom margins as the cups->HWMargins + info can be from the previous page and there the margins + can be swapped due to duplex printing requirements */ (!margins_set || - (fabs(cups->HWMargins[0] - size->left) < 1.0 && - fabs(cups->HWMargins[1] - size->bottom) < 1.0))) + (((fabs(cups->HWMargins[1] - size->left) < 1.0 && + fabs(cups->HWMargins[3] - size->width + size->right) < 1.0) || + (fabs(cups->HWMargins[1] - size->width + size->right) < 1.0 && + fabs(cups->HWMargins[3] - size->left) < 1.0)) && + ((fabs(cups->HWMargins[0] - size->bottom) < 1.0 && + fabs(cups->HWMargins[2] - size->length + size->top) < 1.0) || + (fabs(cups->HWMargins[0] - size->length + size->top) < 1.0 && + fabs(cups->HWMargins[2] - size->bottom) < 1.0))))) break; if (i > 0) @@ -3290,12 +3238,17 @@ cups_put_params(gx_device *pdev, /* /* * Don't reallocate memory unless the device has been opened... + * Also reallocate only if the size has actually changed... */ - if (pdev->is_open) + if (pdev->is_open && (width != width_old || height != height_old)) { + + width_old = width; + height_old = height; + /* - * Device is open, so reallocate... + * Device is open and size has changed, so reallocate... */ dprintf4("DEBUG2: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n", @@ -3769,13 +3722,22 @@ cups_print_chunked(gx_device_printer *pd unsigned char *srcptr, /* Pointer to data */ *dstptr; /* Pointer to bits */ int count; /* Count for loop */ - int flip; /* Flip scanline? */ + int xflip, /* Flip scanline? */ + yflip, /* Reverse scanline order? */ + ystart, yend, ystep; /* Loop control for scanline order */ ppd_attr_t *backside = NULL; + dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); + dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); + dprintf1("DEBUG2: cups->page = %d\n", cups->page); + dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); + if (cupsPPD) { backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); - if (backside) + if (backside) { + dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); cupsPPD->flip_duplex = 0; + } } if (cups->header.Duplex && cupsPPD && ((!cups->header.Tumble && @@ -3785,19 +3747,36 @@ cups_print_chunked(gx_device_printer *pd (backside && (!strcasecmp(backside->value, "Flipped") || !strcasecmp(backside->value, "ManualTumble"))))) && !(cups->page & 1)) - flip = 1; + xflip = 1; else - flip = 0; + xflip = 0; + if (cups->header.Duplex && cupsPPD && + ((!cups->header.Tumble && + (cupsPPD->flip_duplex || + (backside && (!strcasecmp(backside->value, "Flipped") || + !strcasecmp(backside->value, "Rotated"))))) || + (cups->header.Tumble && + (backside && !strcasecmp(backside->value, "ManualTumble")))) && + !(cups->page & 1)) { + yflip = 1; + ystart = cups->height - 1; + yend = -1; + ystep = -1; + } else { + yflip = 0; + ystart = 0; + yend = cups->height; + ystep = 1; + } - dprintf2("DEBUG: cups_print_chunked - flip = %d, height = %d\n", - flip, cups->height); + dprintf3("DEBUG: cups_print_chunked: xflip = %d, yflip = %d, height = %d\n", + xflip, yflip, cups->height); /* * Loop through the page bitmap and write chunked pixels, reversing as * needed... */ - - for (y = 0; y < cups->height; y ++) + for (y = ystart; y != yend; y += ystep) { /* * Grab the scanline data... @@ -3809,7 +3788,7 @@ cups_print_chunked(gx_device_printer *pd gs_exit(gs_lib_ctx_get_non_gc_memory_t(), 1); } - if (flip) + if (xflip) { /* * Flip the raster data before writing it... @@ -3963,13 +3942,22 @@ cups_print_banded(gx_device_printer *pde unsigned char *srcptr; /* Pointer to data */ unsigned char *cptr, *mptr, *yptr, /* Pointer to components */ *kptr, *lcptr, *lmptr; /* ... */ - int flip; /* Flip scanline? */ + int xflip, /* Flip scanline? */ + yflip, /* Reverse scanline order? */ + ystart, yend, ystep; /* Loop control for scanline order */ ppd_attr_t *backside = NULL; + dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); + dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); + dprintf1("DEBUG2: cups->page = %d\n", cups->page); + dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); + if (cupsPPD) { backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); - if (backside) + if (backside) { + dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); cupsPPD->flip_duplex = 0; + } } if (cups->header.Duplex && cupsPPD && ((!cups->header.Tumble && @@ -3979,12 +3967,30 @@ cups_print_banded(gx_device_printer *pde (backside && (!strcasecmp(backside->value, "Flipped") || !strcasecmp(backside->value, "ManualTumble"))))) && !(cups->page & 1)) - flip = 1; + xflip = 1; else - flip = 0; + xflip = 0; + if (cups->header.Duplex && cupsPPD && + ((!cups->header.Tumble && + (cupsPPD->flip_duplex || + (backside && (!strcasecmp(backside->value, "Flipped") || + !strcasecmp(backside->value, "Rotated"))))) || + (cups->header.Tumble && + (backside && !strcasecmp(backside->value, "ManualTumble")))) && + !(cups->page & 1)) { + yflip = 1; + ystart = cups->height - 1; + yend = -1; + ystep = -1; + } else { + yflip = 0; + ystart = 0; + yend = cups->height; + ystep = 1; + } - dprintf2("DEBUG: cups_print_banded - flip = %d, height = %d\n", - flip, cups->height); + dprintf3("DEBUG: cups_print_chunked: xflip = %d, yflip = %d, height = %d\n", + xflip, yflip, cups->height); /* * Loop through the page bitmap and write banded pixels... We have @@ -4001,7 +4007,7 @@ cups_print_banded(gx_device_printer *pde bandbytes = cups->header.cupsBytesPerLine / cups->color_info.num_components; #endif /* CUPS_RASTER_SYNCv1 */ - for (y = 0; y < cups->height; y ++) + for (y = ystart; y != yend; y += ystep) { /* * Grab the scanline data... @@ -4021,7 +4027,7 @@ cups_print_banded(gx_device_printer *pde memset(dst, 0, cups->header.cupsBytesPerLine); else { - if (flip) + if (xflip) cptr = dst + bandbytes - 1; else cptr = dst; @@ -4040,7 +4046,7 @@ cups_print_banded(gx_device_printer *pde switch (cups->header.cupsColorSpace) { default : - for (x = cups->width, bit = flip ? 1 << (x & 7) : 128; + for (x = cups->width, bit = xflip ? 1 << (x & 7) : 128; x > 0; x --, srcptr ++) { @@ -4051,7 +4057,7 @@ cups_print_banded(gx_device_printer *pde if (*srcptr & 0x10) *yptr |= bit; - if (flip) + if (xflip) { if (bit < 128) bit <<= 1; @@ -4077,7 +4083,7 @@ cups_print_banded(gx_device_printer *pde if (*srcptr & 0x1) *yptr |= bit; - if (flip) + if (xflip) { if (bit < 128) bit <<= 1; @@ -4107,7 +4113,7 @@ cups_print_banded(gx_device_printer *pde case CUPS_CSPACE_CMYK : case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : - for (x = cups->width, bit = flip ? 1 << (x & 7) : 128; + for (x = cups->width, bit = xflip ? 1 << (x & 7) : 128; x > 0; x --, srcptr ++) { @@ -4120,7 +4126,7 @@ cups_print_banded(gx_device_printer *pde if (*srcptr & 0x10) *kptr |= bit; - if (flip) + if (xflip) { if (bit < 128) bit <<= 1; @@ -4149,7 +4155,7 @@ cups_print_banded(gx_device_printer *pde if (*srcptr & 0x1) *kptr |= bit; - if (flip) + if (xflip) { if (bit < 128) bit <<= 1; @@ -4175,7 +4181,7 @@ cups_print_banded(gx_device_printer *pde } break; case CUPS_CSPACE_KCMYcm : - for (x = cups->width, bit = flip ? 1 << (x & 7) : 128; + for (x = cups->width, bit = xflip ? 1 << (x & 7) : 128; x > 0; x --, srcptr ++) { @@ -4198,7 +4204,7 @@ cups_print_banded(gx_device_printer *pde if (*srcptr & 0x01) *lmptr |= bit; - if (flip) + if (xflip) { if (bit < 128) bit <<= 1; @@ -4236,7 +4242,7 @@ cups_print_banded(gx_device_printer *pde switch (cups->header.cupsColorSpace) { default : - for (x = cups->width, bit = flip ? 3 << (2 * (x & 3)) : 0xc0; + for (x = cups->width, bit = xflip ? 3 << (2 * (x & 3)) : 0xc0; x > 0; x --, srcptr ++) switch (bit) @@ -4249,7 +4255,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *yptr |= temp << 6; - if (flip) + if (xflip) { bit = 0x03; cptr --; @@ -4267,7 +4273,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *yptr |= temp << 4; - if (flip) + if (xflip) bit = 0xc0; else bit = 0x0c; @@ -4280,7 +4286,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *yptr |= temp << 2; - if (flip) + if (xflip) bit = 0x30; else bit = 0x03; @@ -4293,7 +4299,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *yptr |= temp; - if (flip) + if (xflip) bit = 0x0c; else { @@ -4313,7 +4319,7 @@ cups_print_banded(gx_device_printer *pde case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : case CUPS_CSPACE_KCMYcm : - for (x = cups->width, bit = flip ? 3 << (2 * (x & 3)) : 0xc0; + for (x = cups->width, bit = xflip ? 3 << (2 * (x & 3)) : 0xc0; x > 0; x --, srcptr ++) switch (bit) @@ -4328,7 +4334,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *kptr |= temp << 6; - if (flip) + if (xflip) { bit = 0x03; cptr --; @@ -4349,7 +4355,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *kptr |= temp << 4; - if (flip) + if (xflip) bit = 0xc0; else bit = 0x0c; @@ -4364,7 +4370,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *kptr |= temp << 2; - if (flip) + if (xflip) bit = 0x30; else bit = 0x03; @@ -4379,7 +4385,7 @@ cups_print_banded(gx_device_printer *pde if ((temp = *srcptr & 0x03) != 0) *kptr |= temp; - if (flip) + if (xflip) bit = 0x0c; else { @@ -4401,7 +4407,7 @@ cups_print_banded(gx_device_printer *pde switch (cups->header.cupsColorSpace) { default : - for (x = cups->width, bit = flip && (x & 1) ? 0xf0 : 0x0f; + for (x = cups->width, bit = xflip && (x & 1) ? 0xf0 : 0x0f; x > 0; x --, srcptr += 2) switch (bit) @@ -4416,7 +4422,7 @@ cups_print_banded(gx_device_printer *pde bit = 0x0f; - if (flip) + if (xflip) { cptr --; mptr --; @@ -4433,7 +4439,7 @@ cups_print_banded(gx_device_printer *pde bit = 0xf0; - if (!flip) + if (!xflip) { cptr ++; mptr ++; @@ -4450,7 +4456,7 @@ cups_print_banded(gx_device_printer *pde case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : case CUPS_CSPACE_KCMYcm : - for (x = cups->width, bit = flip && (x & 1) ? 0xf0 : 0x0f; + for (x = cups->width, bit = xflip && (x & 1) ? 0xf0 : 0x0f; x > 0; x --, srcptr += 2) switch (bit) @@ -4467,7 +4473,7 @@ cups_print_banded(gx_device_printer *pde bit = 0x0f; - if (flip) + if (xflip) { cptr --; mptr --; @@ -4487,7 +4493,7 @@ cups_print_banded(gx_device_printer *pde bit = 0xf0; - if (!flip) + if (!xflip) { cptr ++; mptr ++; @@ -4504,7 +4510,7 @@ cups_print_banded(gx_device_printer *pde switch (cups->header.cupsColorSpace) { default : - if (flip) + if (xflip) for (x = cups->width; x > 0; x --) { *cptr-- = *srcptr++; @@ -4527,7 +4533,7 @@ cups_print_banded(gx_device_printer *pde case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : case CUPS_CSPACE_KCMYcm : - if (flip) + if (xflip) for (x = cups->width; x > 0; x --) { *cptr-- = *srcptr++; @@ -4551,7 +4557,7 @@ cups_print_banded(gx_device_printer *pde switch (cups->header.cupsColorSpace) { default : - if (flip) + if (xflip) for (x = cups->width; x > 0; x --, srcptr += 6) { *cptr-- = srcptr[1]; @@ -4580,7 +4586,7 @@ cups_print_banded(gx_device_printer *pde case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : case CUPS_CSPACE_KCMYcm : - if (flip) + if (xflip) for (x = cups->width; x > 0; x --, srcptr += 8) { *cptr-- = srcptr[1];