Commit 0e563e00 authored by Raph Levien's avatar Raph Levien

Committing a patch by Ray Lehtiniemi to speed up 565_d by 25%.

parent 0dece0ba
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
Thu Aug 13 21:06:00 1998 Raph Levien <raph@gtk.org>
* gdk/gdkrgb.c: committing a patch by Ray Lehtiniemi that
speeds up the 565_d case by about 25% total. Thanks Ray!
Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com> Thu Aug 13 16:47:44 1998 Owen Taylor <otaylor@redhat.com>
* Changed GtkSignalFunc back to () from (void). (again!) * Changed GtkSignalFunc back to () from (void). (again!)
......
...@@ -1367,41 +1367,50 @@ gdk_rgb_convert_565_br (GdkImage *image, ...@@ -1367,41 +1367,50 @@ gdk_rgb_convert_565_br (GdkImage *image,
} }
} }
/* Thanks to Ray Lehtiniemi for a patch that resulted in a ~25% speedup
in this mode. */
static void static void
gdk_rgb_convert_565_d (GdkImage *image, gdk_rgb_convert_565_d (GdkImage *image,
gint x0, gint y0, gint width, gint height, gint x0, gint y0, gint width, gint height,
guchar *buf, int rowstride, guchar *buf, int rowstride,
gint x_align, gint y_align, GdkRgbCmap *cmap) gint x_align, gint y_align, GdkRgbCmap *cmap)
{ {
int x, y; int x, y;
guchar *obuf; guchar *obuf;
gint bpl; gint bpl;
guchar *bptr, *bp2; guchar *bptr;
guchar r, g, b;
gint dith;
gint r1, g1, b1;
guchar *dmp;
width += x_align;
height += y_align;
bptr = buf; bptr = buf;
bpl = image->bpl; bpl = image->bpl;
obuf = ((guchar *)image->mem) + y0 * bpl + x0 * 2; obuf = ((guchar *)image->mem) + y0 * bpl + (x0 - x_align) * 2;
for (y = 0; y < height; y++)
for (y = y_align; y < height; y++)
{ {
dmp = DM[(y_align + y) & (DM_HEIGHT - 1)]; guchar * dmp = DM[y & (DM_HEIGHT - 1)];
bp2 = bptr; guchar * bp2 = bptr;
for (x = 0; x < width; x++)
{ for (x = x_align; x < width; x++)
r = *bp2++; {
g = *bp2++; gint32 rgb = *bp2++ << 20;
b = *bp2++; rgb += *bp2++ << 10;
dith = dmp[(x_align + x) & (DM_WIDTH - 1)] >> 3; rgb += *bp2++;
r1 = r + dith; {
g1 = g + ((7 - dith) >> 1); gint32 dith = dmp[x & (DM_WIDTH - 1)] >> 3;
b1 = b + dith; rgb += ((dith << 20) | dith | (((7 - dith) >> 1) << 10));
((unsigned short *)obuf)[x] = (((r1 - (r1 >> 5)) & 0xf8) << 8) | }
(((g1 - (g1 >> 6)) & 0xfc) << 3) | rgb += 0x10040100
(((b1 - (b1 >> 5)) & 0xf8) >> 3); - ((rgb & 0x1e0001e0) >> 5)
} - ((rgb & 0x00070000) >> 6);
((unsigned short *)obuf)[x] =
((rgb & 0x0f800000) >> 12) |
((rgb & 0x0003f000) >> 7) |
((rgb & 0x000000f8) >> 3);
}
bptr += rowstride; bptr += rowstride;
obuf += bpl; obuf += bpl;
} }
......
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