From ac608afdfedb618e0d47d995797f86d2e121f48a Mon Sep 17 00:00:00 2001 From: zonkx <36549474+zonkx@users.noreply.github.com> Date: Fri, 16 Feb 2018 20:57:12 +0100 Subject: [PATCH] Round alpha correctly in bilinear image scaling code too Add 0.5 to round the alpha values correctly too, just as it was already done in f4c9767b493e9239bb3548ebb49e1c3d492e8bdc for the RGB values. Closes https://github.com/wxWidgets/wxWidgets/pull/733 --- src/common/image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index 31b69845cb2a..846eeee64f69 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -844,7 +844,7 @@ wxImage wxImage::ResampleBilinear(int width, int height) const dst_data += 3; if ( src_alpha ) - *dst_alpha++ = static_cast(a1 * dy1 + a2 * dy); + *dst_alpha++ = static_cast(a1 * dy1 + a2 * dy +.5); } }