raster scaling: check for division by zero
This commit is contained in:
parent
53c643092c
commit
93a34cc68d
1 changed files with 16 additions and 8 deletions
|
@ -131,6 +131,12 @@ public:
|
||||||
fg_ptr = reinterpret_cast<const value_type*>(base_type::source().next_y());
|
fg_ptr = reinterpret_cast<const value_type*>(base_type::source().next_y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (total_weight == 0)
|
||||||
|
{
|
||||||
|
span->v = *nodata_value_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fg /= total_weight;
|
fg /= total_weight;
|
||||||
if (fg < std::numeric_limits<value_type>::min())
|
if (fg < std::numeric_limits<value_type>::min())
|
||||||
{
|
{
|
||||||
|
@ -144,6 +150,8 @@ public:
|
||||||
{
|
{
|
||||||
span->v = static_cast<value_type>(fg);
|
span->v = static_cast<value_type>(fg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
span->a = base_mask;
|
span->a = base_mask;
|
||||||
|
|
||||||
++span;
|
++span;
|
||||||
|
|
Loading…
Reference in a new issue