static uint32_t
xcolor_to_argb32 (XColor xc)
{
- return (0xff << 24) | ((xc.red / 256) << 16)
- | ((xc.green / 256) << 8) | (xc.blue / 256);
+ return ((0xffu << 24) | ((xc.red / 256) << 16)
+ | ((xc.green / 256) << 8) | (xc.blue / 256));
}
static uint32_t
{
int width = img->ximg->width;
int height = img->ximg->height;
- unsigned char *data = (unsigned char *) xmalloc (width*height*4);
+ void *data = xmalloc (width * height * 4);
int i;
- uint32_t *od = (uint32_t *)data;
- uint32_t *id = (uint32_t *)img->ximg->data;
+ uint32_t *od = data;
+ uint32_t *id = (uint32_t *) img->ximg->data;
char *mid = img->mask_img ? img->mask_img->data : 0;
uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f);
height = pbm_scan_number (&p, end);
#ifdef USE_CAIRO
- uint32_t *data = xmalloc (width * height * 4);
+ void *data = xmalloc (width * height * 4);
uint32_t *dataptr = data;
#endif
r = (double) r * 255 / max_color_idx;
g = (double) g * 255 / max_color_idx;
b = (double) b * 255 / max_color_idx;
- *dataptr++ = (0xff << 24) | (r << 16) | (g << 8) | b;
+ *dataptr++ = (0xffu << 24) | (r << 16) | (g << 8) | b;
#else
/* RGB values are now in the range 0..max_color_idx.
Scale this to the range 0..0xffff supported by X. */
r = mgr->cinfo.colormap[ir][i];
g = mgr->cinfo.colormap[ig][i];
b = mgr->cinfo.colormap[ib][i];
- *dataptr++ = (0xff << 24) | (r << 16) | (g << 8) | b;
+ *dataptr++ = (0xffu << 24) | (r << 16) | (g << 8) | b;
}
}
EMACS_INT idx;
int gif_err;
-#ifdef USE_CAIRO
- unsigned char *data = 0;
-#else
- unsigned long pixel_colors[256];
- unsigned long bgcolor = 0;
- XImagePtr ximg;
-#endif
-
if (NILP (specified_data))
{
Lisp_Object file = x_find_image_file (specified_file);
#ifdef USE_CAIRO
/* xzalloc so data is zero => transparent */
- data = (unsigned char *) xzalloc (width * height * 4);
+ void *data = xzalloc (width * height * 4);
+ uint32_t *data32 = data;
if (STRINGP (specified_bg))
{
XColor color;
if (x_defined_color (f, SSDATA (specified_bg), &color, 0))
{
- uint32_t *dataptr = (uint32_t *)data;
+ uint32_t *dataptr = data32;
int r = color.red/256;
int g = color.green/256;
int b = color.blue/256;
for (y = 0; y < height; ++y)
for (x = 0; x < width; ++x)
- *dataptr++ = (0xff << 24) | (r << 16) | (g << 8) | b;
+ *dataptr++ = (0xffu << 24) | (r << 16) | (g << 8) | b;
}
}
#else
/* Create the X image and pixmap. */
+ XImagePtr ximg;
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
{
gif_close (gif, NULL);
init_color_table ();
#ifndef USE_CAIRO
+ unsigned long bgcolor;
if (STRINGP (specified_bg))
bgcolor = x_alloc_image_color (f, img, specified_bg,
FRAME_BACKGROUND_PIXEL (f));
#ifndef USE_CAIRO
/* Allocate subimage colors. */
- memset (pixel_colors, 0, sizeof pixel_colors);
+ unsigned long pixel_colors[256] = { 0, };
if (gif_color_map)
for (i = 0; i < gif_color_map->ColorCount; ++i)
{
#ifdef USE_CAIRO
uint32_t *dataptr =
- ((uint32_t*)data + ((row + subimg_top) * subimg_width
- + x + subimg_left));
+ (data32 + ((row + subimg_top) * subimg_width
+ + x + subimg_left));
int r = gif_color_map->Colors[c].Red;
int g = gif_color_map->Colors[c].Green;
int b = gif_color_map->Colors[c].Blue;
if (transparency_color_index != c)
- *dataptr = (0xff << 24) | (r << 16) | (g << 8) | b;
+ *dataptr = (0xffu << 24) | (r << 16) | (g << 8) | b;
#else
XPutPixel (ximg, x + subimg_left, row + subimg_top,
pixel_colors[c]);
{
#ifdef USE_CAIRO
uint32_t *dataptr =
- ((uint32_t*)data + ((y + subimg_top) * subimg_width
- + x + subimg_left));
+ (data32 + ((y + subimg_top) * subimg_width
+ + x + subimg_left));
int r = gif_color_map->Colors[c].Red;
int g = gif_color_map->Colors[c].Green;
int b = gif_color_map->Colors[c].Blue;
if (transparency_color_index != c)
- *dataptr = (0xff << 24) | (r << 16) | (g << 8) | b;
+ *dataptr = (0xffu << 24) | (r << 16) | (g << 8) | b;
#else
XPutPixel (ximg, x + subimg_left, y + subimg_top,
pixel_colors[c]);