Commit df58bb7f authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor
Browse files

Add a fallback for unaligned source data for FORMAT_ARGB_MASK. (#117217)

Mon Aug 18 11:48:51 2003  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdrawable-x11.c (convert_to_format):
        Add a fallback for unaligned source data for
        FORMAT_ARGB_MASK. (#117217)
parent 7a3ce1db
Mon Aug 18 11:48:51 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (convert_to_format):
Add a fallback for unaligned source data for
FORMAT_ARGB_MASK. (#117217)
Mon Aug 18 10:51:57 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Rework handling of REBUILD_PNGS,
......
Mon Aug 18 11:48:51 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (convert_to_format):
Add a fallback for unaligned source data for
FORMAT_ARGB_MASK. (#117217)
Mon Aug 18 10:51:57 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Rework handling of REBUILD_PNGS,
......
Mon Aug 18 11:48:51 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (convert_to_format):
Add a fallback for unaligned source data for
FORMAT_ARGB_MASK. (#117217)
Mon Aug 18 10:51:57 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Rework handling of REBUILD_PNGS,
......
Mon Aug 18 11:48:51 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (convert_to_format):
Add a fallback for unaligned source data for
FORMAT_ARGB_MASK. (#117217)
Mon Aug 18 10:51:57 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Rework handling of REBUILD_PNGS,
......
Mon Aug 18 11:48:51 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (convert_to_format):
Add a fallback for unaligned source data for
FORMAT_ARGB_MASK. (#117217)
Mon Aug 18 10:51:57 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Rework handling of REBUILD_PNGS,
......
......@@ -1079,63 +1079,80 @@ convert_to_format (guchar *src_buf,
}
case FORMAT_ARGB_MASK:
{
guint *p = (guint *)(src_buf + i * src_rowstride);
guint *q = (guint *)(dest_buf + i * dest_rowstride);
guint *end = p + width;
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (dest_byteorder == GDK_LSB_FIRST)
guchar *row = src_buf + i * src_rowstride;
if (((gsize)row & 3) != 0)
{
/* ABGR => ARGB */
guchar *p = row;
guint32 *q = (guint32 *)(dest_buf + i * dest_rowstride);
guchar *end = p + 4 * width;
while (p < end)
{
*q = ( (*p & 0xff00ff00) |
((*p & 0x000000ff) << 16) |
((*p & 0x00ff0000) >> 16));
*q = (p[3] << 24) | (p[0] << 16) | (p[1] << 8) | p[2];
p += 4;
q++;
p++;
}
}
else
{
/* ABGR => BGRA */
guint32 *p = (guint32 *)row;
guint32 *q = (guint32 *)(dest_buf + i * dest_rowstride);
guint32 *end = p + width;
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (dest_byteorder == GDK_LSB_FIRST)
{
/* ABGR => ARGB */
while (p < end)
while (p < end)
{
*q = ( (*p & 0xff00ff00) |
((*p & 0x000000ff) << 16) |
((*p & 0x00ff0000) >> 16));
q++;
p++;
}
}
else
{
*q = (((*p & 0xff000000) >> 24) |
((*p & 0x00ffffff) << 8));
q++;
p++;
/* ABGR => BGRA */
while (p < end)
{
*q = (((*p & 0xff000000) >> 24) |
((*p & 0x00ffffff) << 8));
q++;
p++;
}
}
}
#else /* G_BYTE_ORDER == G_BIG_ENDIAN */
if (dest_byteorder == GDK_LSB_FIRST)
{
/* RGBA => BGRA */
while (p < end)
if (dest_byteorder == GDK_LSB_FIRST)
{
*q = ( (*p & 0x00ff00ff) |
((*p & 0x0000ff00) << 16) |
((*p & 0xff000000) >> 16));
q++;
p++;
}
}
else
{
/* RGBA => ARGB */
/* RGBA => BGRA */
while (p < end)
while (p < end)
{
*q = ( (*p & 0x00ff00ff) |
((*p & 0x0000ff00) << 16) |
((*p & 0xff000000) >> 16));
q++;
p++;
}
}
else
{
*q = (((*p & 0xffffff00) >> 8) |
((*p & 0x000000ff) << 24));
q++;
p++;
/* RGBA => ARGB */
while (p < end)
{
*q = (((*p & 0xffffff00) >> 8) |
((*p & 0x000000ff) << 24));
q++;
p++;
}
}
}
#endif /* G_BYTE_ORDER*/
}
break;
}
case FORMAT_ARGB:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment