fixed color quantization in case of one color and transparency. #539
This commit is contained in:
parent
75dc292eb9
commit
8369278662
1 changed files with 4 additions and 2 deletions
|
@ -263,8 +263,10 @@ public:
|
|||
{
|
||||
byte a = preprocessAlpha(c.a);
|
||||
unsigned ind=0;
|
||||
if (a < InsertPolicy::MIN_ALPHA || colors_ <= 1)
|
||||
if (a < InsertPolicy::MIN_ALPHA || colors_ == 0)
|
||||
return 0;
|
||||
if (colors_ == 1)
|
||||
return pal_remap_[has_hole_?1:0];
|
||||
|
||||
rgba_hash_table::iterator it = color_hashmap_.find(c);
|
||||
if (it == color_hashmap_.end())
|
||||
|
@ -472,7 +474,7 @@ private:
|
|||
}
|
||||
tries=0;
|
||||
// ignore leaves and also nodes with small mean error and not excessive number of pixels
|
||||
if (cur_node->reduce_cost / cur_node->pixel_count * std::log(long(cur_node->pixel_count)) > 20
|
||||
if ((cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(long(cur_node->pixel_count)) > 15
|
||||
&& cur_node->children_count > 0)
|
||||
{
|
||||
colors_--;
|
||||
|
|
Loading…
Reference in a new issue