replaced a bitshift with a binary and. Should be unnoticeably faster ;)

2004-09-16  Sven Neumann  <sven@gimp.org>

	* app/core/gimpscanconvert.c (VALUE_TO_PIXEL): replaced a bitshift
	with a binary and. Should be unnoticeably faster ;)
This commit is contained in:
Sven Neumann 2004-09-16 11:31:30 +00:00 committed by Sven Neumann
parent fc01210b78
commit 29b455c901
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2004-09-16 Sven Neumann <sven@gimp.org>
* app/core/gimpscanconvert.c (VALUE_TO_PIXEL): replaced a bitshift
with a binary and. Should be unnoticeably faster ;)
2004-09-16 Michael Natterer <mitch@gimp.org>
* app/pdb/procedural_db.c: removed #if 0'ed code, took assignments

View File

@ -554,15 +554,18 @@ gimp_scan_convert_render_callback (gpointer user_data,
ArtSVPRenderAAStep *steps,
gint n_steps)
{
gint k, run_x0, run_x1;
GimpScanConvert *sc = user_data;
gint cur_value = start_value;
GimpScanConvert *sc = (GimpScanConvert *) user_data;
gint k, run_x0, run_x1;
#define VALUE_TO_PIXEL(x) (sc->antialias ? (x) >> 16 : ((x) >> 23 ? 255 : 0))
#define VALUE_TO_PIXEL(x) (sc->antialias ? \
((x) >> 16) : \
(((x) & (1 << 23) ? 255 : 0)))
if (n_steps > 0)
{
run_x1 = steps[0].x;
if (run_x1 > sc->x0)
memset (sc->buf,
VALUE_TO_PIXEL (cur_value),
@ -571,8 +574,10 @@ gimp_scan_convert_render_callback (gpointer user_data,
for (k = 0; k < n_steps - 1; k++)
{
cur_value += steps[k].delta;
run_x0 = run_x1;
run_x1 = steps[k + 1].x;
if (run_x1 > run_x0)
memset (sc->buf + run_x0 - sc->x0,
VALUE_TO_PIXEL (cur_value),
@ -580,6 +585,7 @@ gimp_scan_convert_render_callback (gpointer user_data,
}
cur_value += steps[k].delta;
if (sc->x1 > run_x1)
memset (sc->buf + run_x1 - sc->x0,
VALUE_TO_PIXEL (cur_value),