mirror of https://github.com/GNOME/gimp.git
----------------------------------------------------------------------
---------------------------------------------------------------------- Modified Files: ChangeLog app/paint_funcs.c speed up to color_pixels (4-7X on a mips r4000) ----------------------------------------------------------------------
This commit is contained in:
parent
56a2e76f73
commit
f0426ac257
|
@ -1,3 +1,8 @@
|
|||
Sun Jul 19 10:23:58 PDT 1998 Jay Cox <jaycox@earthlink.net>
|
||||
* app/paint_funcs.c
|
||||
new and improved color_pixels now 4-7 times as fast and 8-12
|
||||
times as convoluted as original color_pixels.
|
||||
|
||||
Sun Jul 19 12:48:00 BST 1998 Adam D. Moss <adam@gimp.org>
|
||||
|
||||
* plug-ins/animationplay/animationplay.c: Adapted
|
||||
|
|
|
@ -367,15 +367,61 @@ color_pixels (unsigned char *dest,
|
|||
int w,
|
||||
int bytes)
|
||||
{
|
||||
int b;
|
||||
/* dest % bytes and color % bytes must be 0 or we will crash
|
||||
when bytes = 2 or 4.
|
||||
Is this safe to assume? Lets find out.
|
||||
This is 4-7X as fast as the simple version.
|
||||
*/
|
||||
register unsigned char c0, c1, c2;
|
||||
register guint32 *longd, longc;
|
||||
register guint16 *shortd, shortc;
|
||||
switch (bytes)
|
||||
{
|
||||
case 1:
|
||||
memset(dest, *color, w);
|
||||
break;
|
||||
case 2:
|
||||
shortc = ((guint16 *)color)[0];
|
||||
shortd = (guint16 *)dest;
|
||||
while (w--)
|
||||
{
|
||||
*shortd = shortc;
|
||||
shortd++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
c0 = color[0];
|
||||
c1 = color[1];
|
||||
c2 = color[2];
|
||||
while (w--)
|
||||
{
|
||||
dest[0] = c0;
|
||||
dest[1] = c1;
|
||||
dest[2] = c2;
|
||||
dest += 3;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
longc = ((guint32 *)color)[0];
|
||||
longd = (guint32 *)dest;
|
||||
while (w--)
|
||||
{
|
||||
*longd = longc;
|
||||
longd++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
int b;
|
||||
while (w--)
|
||||
{
|
||||
for (b = 0; b < bytes; b++)
|
||||
dest[b] = color[b];
|
||||
|
||||
while (w--)
|
||||
{
|
||||
for (b = 0; b < bytes; b++)
|
||||
dest[b] = color[b];
|
||||
|
||||
dest += bytes;
|
||||
}
|
||||
dest += bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -367,15 +367,61 @@ color_pixels (unsigned char *dest,
|
|||
int w,
|
||||
int bytes)
|
||||
{
|
||||
int b;
|
||||
/* dest % bytes and color % bytes must be 0 or we will crash
|
||||
when bytes = 2 or 4.
|
||||
Is this safe to assume? Lets find out.
|
||||
This is 4-7X as fast as the simple version.
|
||||
*/
|
||||
register unsigned char c0, c1, c2;
|
||||
register guint32 *longd, longc;
|
||||
register guint16 *shortd, shortc;
|
||||
switch (bytes)
|
||||
{
|
||||
case 1:
|
||||
memset(dest, *color, w);
|
||||
break;
|
||||
case 2:
|
||||
shortc = ((guint16 *)color)[0];
|
||||
shortd = (guint16 *)dest;
|
||||
while (w--)
|
||||
{
|
||||
*shortd = shortc;
|
||||
shortd++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
c0 = color[0];
|
||||
c1 = color[1];
|
||||
c2 = color[2];
|
||||
while (w--)
|
||||
{
|
||||
dest[0] = c0;
|
||||
dest[1] = c1;
|
||||
dest[2] = c2;
|
||||
dest += 3;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
longc = ((guint32 *)color)[0];
|
||||
longd = (guint32 *)dest;
|
||||
while (w--)
|
||||
{
|
||||
*longd = longc;
|
||||
longd++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
int b;
|
||||
while (w--)
|
||||
{
|
||||
for (b = 0; b < bytes; b++)
|
||||
dest[b] = color[b];
|
||||
|
||||
while (w--)
|
||||
{
|
||||
for (b = 0; b < bytes; b++)
|
||||
dest[b] = color[b];
|
||||
|
||||
dest += bytes;
|
||||
}
|
||||
dest += bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue