/*
- * "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $"
+ * "$Id: raster.c 6649 2007-07-11 21:46:42Z mike $"
*
* Raster file routines for the Common UNIX Printing System (CUPS).
*
+ * Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
r->sync == CUPS_RASTER_REVSYNCv1 ||
r->sync == CUPS_RASTER_REVSYNCv2)
r->swapped = 1;
+
+ DEBUG_printf(("r->swapped=%d, r->sync=%08x\n", r->swapped, r->sync));
}
else
{
unsigned remaining; /* Bytes remaining */
-#ifdef DEBUG
- fprintf(stderr, "cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n",
- r, p, len, r->remaining);
-#endif /* DEBUG */
+ DEBUG_printf(("cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n",
+ r, p, len, r->remaining));
if (r == NULL || r->mode != CUPS_RASTER_WRITE || r->remaining == 0)
return (0);
cups_raster_read_header(
cups_raster_t *r) /* I - Raster stream */
{
- int len; /* Number of words to swap */
- union swap_s /* Swapping structure */
- {
- unsigned char b[4];
- unsigned v;
- } *s;
+ int len; /* Length for read/swap */
if (r == NULL || r->mode != CUPS_RASTER_READ)
*/
if (r->swapped)
- for (len = 81, s = (union swap_s *)&(r->header.AdvanceDistance);
+ {
+ unsigned *s, /* Current word */
+ temp; /* Temporary copy */
+
+
+ DEBUG_puts("Swapping header bytes...");
+
+ for (len = 81, s = &(r->header.AdvanceDistance);
len > 0;
len --, s ++)
- s->v = (((((s->b[3] << 8) | s->b[2]) << 8) | s->b[1]) << 8) | s->b[0];
+ {
+ DEBUG_printf(("%08x =>", *s));
+
+ temp = *s;
+ *s = ((temp & 0xff) << 24) |
+ ((temp & 0xff00) << 8) |
+ ((temp & 0xff0000) >> 8) |
+ ((temp & 0xff000000) >> 24);
+
+ DEBUG_printf((" %08x\n", *s));
+ }
+ }
/*
* Update the header and row count...
maxrun; /* Maximum run of 128 * bpp */
-#ifdef DEBUG
- fprintf(stderr, "cups_raster_write(r=%p, pixels=%p)\n", r, pixels);
-#endif /* DEBUG */
+ DEBUG_printf(("cups_raster_write(r=%p, pixels=%p)\n", r, pixels));
/*
* Allocate a write buffer as needed...
/*
- * End of "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $".
+ * End of "$Id: raster.c 6649 2007-07-11 21:46:42Z mike $".
*/