summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDraw.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index cfdfc22..e382a48 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.10 2006/01/10 05:38:20 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.11 2006/03/02 20:44:25 hobbs Exp $
*/
#include "tkInt.h"
@@ -382,18 +382,18 @@ XCopyPlane(
void
TkPutImage(
- unsigned long *colors, /* Unused on Macintosh. */
- int ncolors, /* Unused on Macintosh. */
- Display* display, /* Display. */
- Drawable d, /* Drawable to place image on. */
- GC gc, /* GC to use. */
- XImage* image, /* Image to place. */
- int src_x, /* Source X & Y. */
+ unsigned long *colors, /* Unused on Macintosh. */
+ int ncolors, /* Unused on Macintosh. */
+ Display* display, /* Display. */
+ Drawable d, /* Drawable to place image on. */
+ GC gc, /* GC to use. */
+ XImage* image, /* Image to place. */
+ int src_x, /* Source X & Y. */
int src_y,
- int dest_x, /* Destination X & Y. */
+ int dest_x, /* Destination X & Y. */
int dest_y,
- unsigned int width, /* Same width & height for both */
- unsigned int height) /* distination and source. */
+ unsigned int width, /* Same width & height for both */
+ unsigned int height) /* distination and source. */
{
CGrafPtr saveWorld;
GDHandle saveDevice;
@@ -423,9 +423,8 @@ TkPutImage(
GetPortBitMapForCopyBits(destPort),
&srcRect, &destRect, srcCopy, NULL);
} else if (image->depth == 1) {
-
- /*
- * This code assumes a pixel depth of 1
+ /*
+ * This code assumes a pixel depth of 1
*/
bitmap.bounds.top = bitmap.bounds.left = 0;
@@ -434,7 +433,7 @@ TkPutImage(
if ((image->bytes_per_line % 2) == 1) {
char *newPtr, *oldPtr;
newData = (char *) ckalloc(image->height *
- (image->bytes_per_line + 1));
+ (image->bytes_per_line + 1));
newPtr = newData;
oldPtr = image->data;
for (i = 0; i < image->height; i++) {
@@ -442,30 +441,28 @@ TkPutImage(
*newPtr = InvertByte((unsigned char) *oldPtr);
newPtr++, oldPtr++;
}
- *newPtr = 0;
- newPtr++;
+ *newPtr = 0;
+ newPtr++;
}
bitmap.baseAddr = newData;
bitmap.rowBytes = image->bytes_per_line + 1;
} else {
- newData = (char *) ckalloc(image->height * image->bytes_per_line);
- for (i = 0; i < image->height * image->bytes_per_line; i++) {
+ size_t size = image->height * image->bytes_per_line;
+ newData = (char *) ckalloc((int) size);
+ for (i = 0; i < size; i++) {
newData[i] = InvertByte((unsigned char) image->data[i]);
- }
+ }
bitmap.baseAddr = newData;
bitmap.rowBytes = image->bytes_per_line;
}
destBits = GetPortBitMapForCopyBits(destPort);
- CopyBits(&bitmap, destBits,
- &srcRect, &destRect, srcCopy, NULL);
-
+ CopyBits(&bitmap, destBits, &srcRect, &destRect, srcCopy, NULL);
} else {
- /*
- * Color image
+ /*
+ * Color image
*/
-
PixMap pixmap;
-
+
pixmap.bounds.left = 0;
pixmap.bounds.top = 0;
pixmap.bounds.right = (short) image->width;
@@ -479,16 +476,20 @@ TkPutImage(
pixmap.pixelSize = 32;
pixmap.cmpCount = 3;
pixmap.cmpSize = 8;
+#ifdef WORDS_BIGENDIAN
pixmap.pixelFormat = k32ARGBPixelFormat;
+#else
+ pixmap.pixelFormat = k32BGRAPixelFormat;
+#endif
pixmap.pmTable = NULL;
pixmap.pmExt = 0;
pixmap.baseAddr = image->data;
pixmap.rowBytes = image->bytes_per_line | 0x8000;
-
+
CopyBits((BitMap *) &pixmap, GetPortBitMapForCopyBits(destPort),
&srcRect, &destRect, srcCopy, NULL);
}
-
+
if (newData != NULL) {
ckfree(newData);
}