| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
#else
/* swap endianness first */
- data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
+ data = s[1] << 24 | s[0] << 16 | s[3] << 8 | s[2];
s += 4;
- *o++ = (data & 0xf800) | (data & 0xe000) >> 5
- | (data & 0x7e0) >> 3 | (data & 0x600) >> 9;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0xf8000000) >> 24 | (data & 0xe0000000) >> 29;
- *o++ = (data & 0x7e00000) >> 11 | (data & 0x6000000) >> 17
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
+
+ *o++ = (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21
+ | (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25;
+ *o++ = (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10
+ | (data & 0xf800) >> 8 | (data & 0xe000) >> 13;
+ *o++ = (data & 0x7e0) << 5 | (data & 0x600) >> 1
+ | (data & 0x1f) << 3 | (data & 0x1c) >> 2;
#endif
}
/* check for last remaining pixel */
| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
#else
data = *s++;
- *o++ = (data & 0xf800) | (data & 0xe000) >> 5
- | (data & 0x7e0) >> 3 | (data & 0x600) >> 9;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0xf8000000) >> 24 | (data & 0xe0000000) >> 29;
- *o++ = (data & 0x7e00000) >> 11 | (data & 0x6000000) >> 17
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
+ *o++ = (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21
+ | (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25;
+ *o++ = (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10
+ | (data & 0xf800) >> 8 | (data & 0xe000) >> 13;
+ *o++ = (data & 0x7e0) << 5 | (data & 0x600) >> 1
+ | (data & 0x1f) << 3 | (data & 0x1c) >> 2;
#endif
}
/* check for last remaining pixel */
bpl = image->bpl;
v = gdk_colormap_get_visual(cmap);
+ if (image->depth != v->depth)
+ {
+ g_warning ("%s: The depth of the source image (%d) doesn't "
+ "match the depth of the colormap passed in (%d).",
+ G_STRLOC, image->depth, v->depth);
+ return;
+ }
+
d(printf("rgb mask/shift/prec = %x:%x:%x %d:%d:%d %d:%d:%d\n",
v->red_mask, v->green_mask, v->blue_mask,
v->red_shift, v->green_shift, v->blue_shift,
}
v = gdk_colormap_get_visual (cmap);
+
+ if (image->depth != v->depth)
+ {
+ g_warning ("%s: The depth of the source image (%d) doesn't "
+ "match the depth of the colormap passed in (%d).",
+ G_STRLOC, image->depth, v->depth);
+ return;
+ }
+
bank = 5; /* default fallback converter */
index = (image->byte_order == GDK_MSB_FIRST) | (alpha != 0) << 1;
return NULL;
}
+ if (cmap != NULL && depth != cmap->visual->depth)
+ {
+ g_warning ("%s: Depth of the source drawable is %d where as "
+ "the visual depth of the colormap passed is %d",
+ G_STRLOC, depth, cmap->visual->depth);
+ return NULL;
+ }
+
/* Coordinate sanity checks */
if (GDK_IS_PIXMAP (src))
return NULL;
}
+ if (cmap != NULL && src->depth != cmap->visual->depth)
+ {
+ g_warning ("%s: Depth of the Source image is %d where as "
+ "the visual depth of the colormap passed is %d",
+ G_STRLOC, src->depth, cmap->visual->depth);
+ return NULL;
+ }
+
/* Coordinate sanity checks */
g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);