mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 18:21:12 +00:00
add an assert to detect possible division by zero
issue found by coverity
This commit is contained in:
parent
9f69a5196e
commit
968d8a900d
@ -1689,6 +1689,7 @@ surface blur_alpha_surface(const surface &surf, int depth, bool optimize)
|
|||||||
|
|
||||||
p = lock.pixels() + x;
|
p = lock.pixels() + x;
|
||||||
for(y = 0; y < res->h; ++y, p += res->w) {
|
for(y = 0; y < res->h; ++y, p += res->w) {
|
||||||
|
assert(avg);
|
||||||
*p = (std::min(alpha/avg,ff) << 24) | (std::min(red/avg,ff) << 16) | (std::min(green/avg,ff) << 8) | std::min(blue/avg,ff);
|
*p = (std::min(alpha/avg,ff) << 24) | (std::min(red/avg,ff) << 16) | (std::min(green/avg,ff) << 8) | std::min(blue/avg,ff);
|
||||||
if(y >= depth) {
|
if(y >= depth) {
|
||||||
alpha -= ((*front) >> 24)&0xFF;
|
alpha -= ((*front) >> 24)&0xFF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user