GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit a6a10ee0 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Split correction into multiple pieces if no single weight is large enough

2003-07-18  Matthias Clasen  <maclas@gmx.de>

	* pixops/pixops.c (correct_total): Split correction into multiple pieces if no single weight is large
	enough to apply the unsplit correction.  (#117431, problem reported by Tomas Ögren)
parent e733ed3e
2003-07-18 Matthias Clasen <maclas@gmx.de>
* pixops/pixops.c (correct_total): Split correction into multiple pieces if no single weight is large
enough to apply the unsplit correction. (#117431, problem reported by Tomas gren)
2003-07-13 Matthias Clasen <maclas@gmx.de>
* gdk-pixbuf.h:
......
......@@ -952,18 +952,21 @@ correct_total (int *weights,
double overall_alpha)
{
int correction = (int)(0.5 + 65536 * overall_alpha) - total;
int remaining, c, d, i;
if (correction != 0)
{
int i;
for (i = n_x * n_y - 1; i >= 0; i--)
{
if (*(weights + i) + correction >= 0)
{
*(weights + i) += correction;
break;
}
}
remaining = correction;
for (d = 1, c = correction; c != 0 && remaining != 0; d++, c = correction / d)
for (i = n_x * n_y - 1; i >= 0 && c != 0 && remaining != 0; i--)
if (*(weights + i) + c >= 0)
{
*(weights + i) += c;
remaining -= c;
if ((0 < remaining && remaining < c) ||
(0 > remaining && remaining > c))
c = remaining;
}
}
}
......
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