Skip to content

Commit

Permalink
Revert "Quell divide-by-zero warning"
Browse files Browse the repository at this point in the history
This reverts commit 07b0477.

This code is performance-critical: adding a branch for every pixel in
the surface isn't a good idea. @GregoryLundberg was fine with reverting
the commit, as well. The same is true for the next two reverts.

Fixing Coverity Scan warnings is good and all, but we shouldn't
sacrifice performance for it.
  • Loading branch information
jyrkive committed Nov 1, 2017
1 parent 631acb2 commit 9c18a44
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/sdl/utils.cpp
Expand Up @@ -1628,7 +1628,6 @@ surface blur_alpha_surface(const surface &surf, int depth)

p = lock.pixels() + y*res->w;
for(x = 0; x < res->w; ++x, ++p) {
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);
if(x >= depth) {
alpha -= ((*front) >> 24)&0xFF;
Expand Down

0 comments on commit 9c18a44

Please sign in to comment.