mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-25 22:54:46 +03:00
[QuantOctree.c] Remove further attempts to average over empty buckets:
* Skip cube updates for empty buckets in "add_lookup_buckets". * Don't explicitly set pixel value in create_palette_array; the array is already zero-initialized, and zero is as good as any value for the average over nothing.
This commit is contained in:
parent
2e17e0f618
commit
96866f90cd
|
@ -296,6 +296,7 @@ void add_lookup_buckets(ColorCube cube, ColorBucket palette, long nColors, long
|
|||
long i;
|
||||
Pixel p;
|
||||
for (i=offset; i<offset+nColors; i++) {
|
||||
if (palette[i].count == 0) continue;
|
||||
avg_color_from_color_bucket(&palette[i], &p);
|
||||
set_lookup_value(cube, &p, i);
|
||||
}
|
||||
|
@ -328,6 +329,7 @@ create_palette_array(const ColorBucket palette, unsigned int paletteLength) {
|
|||
if (!paletteArray) return NULL;
|
||||
|
||||
for (i=0; i<paletteLength; i++) {
|
||||
if (palette[i].count == 0) continue;
|
||||
avg_color_from_color_bucket(&palette[i], &paletteArray[i]);
|
||||
}
|
||||
return paletteArray;
|
||||
|
|
Loading…
Reference in New Issue
Block a user