diff options
Diffstat (limited to 'win/tkWinImage.c')
-rw-r--r-- | win/tkWinImage.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/win/tkWinImage.c b/win/tkWinImage.c index 37e4351..97ce065 100644 --- a/win/tkWinImage.c +++ b/win/tkWinImage.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinImage.c,v 1.11 2007/01/12 10:41:23 dkf Exp $ + * RCS: @(#) $Id: tkWinImage.c,v 1.14 2010/12/17 15:14:22 nijtmans Exp $ */ #include "tkWinInt.h" @@ -70,7 +70,7 @@ ImageGetPixel( int x, int y) { unsigned long pixel = 0; - unsigned char *srcPtr = &(image->data[(y * image->bytes_per_line) + unsigned char *srcPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line) + ((x * image->bits_per_pixel) / NBBY)]); switch (image->bits_per_pixel) { @@ -118,7 +118,7 @@ PutPixel( int x, int y, unsigned long pixel) { - unsigned char *destPtr = &(image->data[(y * image->bytes_per_line) + unsigned char *destPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line) + ((x * image->bits_per_pixel) / NBBY)]); switch (image->bits_per_pixel) { @@ -303,8 +303,7 @@ XGetImageZPixmap( BOOL ret; if (format != ZPixmap) { - TkpDisplayWarning( - "XGetImageZPixmap: only ZPixmap types are implemented", + TkpDisplayWarning("Only ZPixmap types are implemented", "XGetImageZPixmap Failure"); return NULL; } @@ -370,16 +369,16 @@ XGetImageZPixmap( unsigned char *p, *pend; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, (char *) data, width, height, 32, (int) ((width + 31) >> 3) & ~1); if (ret_image == NULL) { - ckfree(data); + ckfree((char *) data); goto cleanup; } @@ -406,13 +405,13 @@ XGetImageZPixmap( unsigned char *p; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, (char *) data, width, height, 8, (int) width); if (ret_image == NULL) { ckfree((char *) data); @@ -437,13 +436,13 @@ XGetImageZPixmap( } } else if (depth == 16) { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 16, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 16, ZPixmap, 0, (char *) data, width, height, 16, 0 /* will be calc'ed from bitmap_pad */); if (ret_image == NULL) { ckfree((char *) data); @@ -463,13 +462,13 @@ XGetImageZPixmap( } } else { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(width * height * 4); + data = (unsigned char *) ckalloc(width * height * 4); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, (char *) data, width, height, 0, (int) width * 4); if (ret_image == NULL) { ckfree((char *) data); @@ -486,7 +485,7 @@ XGetImageZPixmap( unsigned int byte_width, h, w; byte_width = ((width * 3 + 3) & ~(unsigned)3); - smallBitBase = ckalloc(byte_width * height); + smallBitBase = (unsigned char *) ckalloc(byte_width * height); if (!smallBitBase) { ckfree((char *) ret_image->data); ckfree((char *) ret_image); @@ -513,7 +512,7 @@ XGetImageZPixmap( */ for (h = 0; h < height; h++) { - bigBitData = ret_image->data + h * ret_image->bytes_per_line; + bigBitData = (unsigned char *) ret_image->data + h * ret_image->bytes_per_line; smallBitData = smallBitBase + h * byte_width; for (w = 0; w < width; w++) { @@ -641,7 +640,7 @@ XGetImage( imagePtr = XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format); } else { - char *errMsg = NULL; + const char *errMsg = NULL; char infoBuf[sizeof(BITMAPINFO) + sizeof(RGBQUAD)]; BITMAPINFO *infoPtr = (BITMAPINFO*)infoBuf; |