From 9c18a44f526a326de9dd5a6b9fc6ecea8e58ccf5 Mon Sep 17 00:00:00 2001 From: Jyrki Vesterinen Date: Wed, 1 Nov 2017 18:13:56 +0200 Subject: [PATCH] Revert "Quell divide-by-zero warning" This reverts commit 07b04775ff3995fca279b15750860f5e79ae2f63. 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. --- src/sdl/utils.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdl/utils.cpp b/src/sdl/utils.cpp index 36b9bf15e402..5fe539ec5a64 100644 --- a/src/sdl/utils.cpp +++ b/src/sdl/utils.cpp @@ -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;