Commit 2b4efe26 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

x11: Remove _gdk_x11_convert_to_format()

It's unused now.
parent 47292f28
......@@ -285,178 +285,6 @@ gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap)
return ((GdkPixmapObject *)pixmap)->impl;
}
#if 0
static void
list_formats (XRenderPictFormat *pf)
{
gint i;
for (i=0 ;; i++)
{
XRenderPictFormat *pf = XRenderFindFormat (impl->xdisplay, 0, NULL, i);
if (pf)
{
g_print ("%2d R-%#06x/%#06x G-%#06x/%#06x B-%#06x/%#06x A-%#06x/%#06x\n",
pf->depth,
pf->direct.red,
pf->direct.redMask,
pf->direct.green,
pf->direct.greenMask,
pf->direct.blue,
pf->direct.blueMask,
pf->direct.alpha,
pf->direct.alphaMask);
}
else
break;
}
}
#endif
void
_gdk_x11_convert_to_format (guchar *src_buf,
gint src_rowstride,
guchar *dest_buf,
gint dest_rowstride,
GdkX11FormatType dest_format,
GdkByteOrder dest_byteorder,
gint width,
gint height)
{
gint i;
for (i=0; i < height; i++)
{
switch (dest_format)
{
case GDK_X11_FORMAT_EXACT_MASK:
{
memcpy (dest_buf + i * dest_rowstride,
src_buf + i * src_rowstride,
width * 4);
break;
}
case GDK_X11_FORMAT_ARGB_MASK:
{
guchar *row = src_buf + i * src_rowstride;
if (((gsize)row & 3) != 0)
{
guchar *p = row;
guint32 *q = (guint32 *)(dest_buf + i * dest_rowstride);
guchar *end = p + 4 * width;
while (p < end)
{
*q = (p[3] << 24) | (p[0] << 16) | (p[1] << 8) | p[2];
p += 4;
q++;
}
}
else
{
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)
{
*q = ( (*p & 0xff00ff00) |
((*p & 0x000000ff) << 16) |
((*p & 0x00ff0000) >> 16));
q++;
p++;
}
}
else
{
/* 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)
{
*q = ( (*p & 0x00ff00ff) |
((*p & 0x0000ff00) << 16) |
((*p & 0xff000000) >> 16));
q++;
p++;
}
}
else
{
/* RGBA => ARGB */
while (p < end)
{
*q = (((*p & 0xffffff00) >> 8) |
((*p & 0x000000ff) << 24));
q++;
p++;
}
}
#endif /* G_BYTE_ORDER*/
}
break;
}
case GDK_X11_FORMAT_ARGB:
{
guchar *p = (src_buf + i * src_rowstride);
guchar *q = (dest_buf + i * dest_rowstride);
guchar *end = p + 4 * width;
guint t1,t2,t3;
#define MULT(d,c,a,t) G_STMT_START { t = c * a; d = ((t >> 8) + t) >> 8; } G_STMT_END
if (dest_byteorder == GDK_LSB_FIRST)
{
while (p < end)
{
MULT(q[0], p[2], p[3], t1);
MULT(q[1], p[1], p[3], t2);
MULT(q[2], p[0], p[3], t3);
q[3] = p[3];
p += 4;
q += 4;
}
}
else
{
while (p < end)
{
q[0] = p[3];
MULT(q[1], p[0], p[3], t1);
MULT(q[2], p[1], p[3], t2);
MULT(q[3], p[2], p[3], t3);
p += 4;
q += 4;
}
}
#undef MULT
break;
}
case GDK_X11_FORMAT_NONE:
g_assert_not_reached ();
break;
}
}
}
static void
gdk_x11_cairo_surface_destroy (void *data)
{
......
......@@ -38,14 +38,6 @@ G_BEGIN_DECLS
/* Drawable implementation for X11
*/
typedef enum
{
GDK_X11_FORMAT_NONE,
GDK_X11_FORMAT_EXACT_MASK,
GDK_X11_FORMAT_ARGB_MASK,
GDK_X11_FORMAT_ARGB
} GdkX11FormatType;
typedef struct _GdkDrawableImplX11 GdkDrawableImplX11;
typedef struct _GdkDrawableImplX11Class GdkDrawableImplX11Class;
......@@ -78,15 +70,6 @@ struct _GdkDrawableImplX11Class
GType _gdk_drawable_impl_x11_get_type (void);
void _gdk_x11_convert_to_format (guchar *src_buf,
gint src_rowstride,
guchar *dest_buf,
gint dest_rowstride,
GdkX11FormatType dest_format,
GdkByteOrder dest_byteorder,
gint width,
gint height);
/* Note that the following take GdkDrawableImplX11, not the wrapper drawable */
void _gdk_x11_drawable_finish (GdkDrawable *drawable);
void _gdk_x11_drawable_update_size (GdkDrawable *drawable);
......
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