diff --git a/src/common/image.cpp b/src/common/image.cpp index 40b0ab0325..cdda93c367 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -769,9 +769,9 @@ wxImage wxImage::ResampleBilinear(int width, int height) const // result lines - dst_data[0] = static_cast(r1 * dy1 + r2 * dy); - dst_data[1] = static_cast(g1 * dy1 + g2 * dy); - dst_data[2] = static_cast(b1 * dy1 + b2 * dy); + dst_data[0] = static_cast(r1 * dy1 + r2 * dy + .5); + dst_data[1] = static_cast(g1 * dy1 + g2 * dy + .5); + dst_data[2] = static_cast(b1 * dy1 + b2 * dy + .5); dst_data += 3; if ( src_alpha ) diff --git a/tests/image/horse_bilinear_100x100.png b/tests/image/horse_bilinear_100x100.png index 390ed5843c..32a4d57f75 100644 Binary files a/tests/image/horse_bilinear_100x100.png and b/tests/image/horse_bilinear_100x100.png differ diff --git a/tests/image/horse_bilinear_150x150.png b/tests/image/horse_bilinear_150x150.png index b17ca3a603..5a669dddc0 100644 Binary files a/tests/image/horse_bilinear_150x150.png and b/tests/image/horse_bilinear_150x150.png differ diff --git a/tests/image/horse_bilinear_300x300.png b/tests/image/horse_bilinear_300x300.png index d4c5d06f76..ce7c824d42 100644 Binary files a/tests/image/horse_bilinear_300x300.png and b/tests/image/horse_bilinear_300x300.png differ diff --git a/tests/image/horse_bilinear_50x50.png b/tests/image/horse_bilinear_50x50.png index 6e7a7eee2d..defc189b8e 100644 Binary files a/tests/image/horse_bilinear_50x50.png and b/tests/image/horse_bilinear_50x50.png differ diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 66023ff544..b94cfec690 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -1346,7 +1346,14 @@ void ImageTestCase::BMPFlippingAndRLECompression() } +// The 0 below can be replaced with 1 to generate, instead of comparing with, +// the test files. #define ASSERT_IMAGE_EQUAL_TO_FILE(image, file) \ + if ( 0 ) \ + { \ + CPPUNIT_ASSERT_MESSAGE( "Failed to save " file, image.SaveFile(file) ); \ + } \ + else \ { \ wxImage imageFromFile(file); \ CPPUNIT_ASSERT_MESSAGE( "Failed to load " file, imageFromFile.IsOk() ); \