Try rounding the values when resizing wxImage instead of truncating.
This would seem to make more sense and might also fix the test failures resulting from tiny differences in arithmetic operations when compiled with different compilers/under different architectures. Regenerate the test files and commit (disabled) change to the unit test allowing to do it again in the future. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
@@ -769,9 +769,9 @@ wxImage wxImage::ResampleBilinear(int width, int height) const
|
|||||||
|
|
||||||
// result lines
|
// result lines
|
||||||
|
|
||||||
dst_data[0] = static_cast<unsigned char>(r1 * dy1 + r2 * dy);
|
dst_data[0] = static_cast<unsigned char>(r1 * dy1 + r2 * dy + .5);
|
||||||
dst_data[1] = static_cast<unsigned char>(g1 * dy1 + g2 * dy);
|
dst_data[1] = static_cast<unsigned char>(g1 * dy1 + g2 * dy + .5);
|
||||||
dst_data[2] = static_cast<unsigned char>(b1 * dy1 + b2 * dy);
|
dst_data[2] = static_cast<unsigned char>(b1 * dy1 + b2 * dy + .5);
|
||||||
dst_data += 3;
|
dst_data += 3;
|
||||||
|
|
||||||
if ( src_alpha )
|
if ( src_alpha )
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -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) \
|
#define ASSERT_IMAGE_EQUAL_TO_FILE(image, file) \
|
||||||
|
if ( 0 ) \
|
||||||
|
{ \
|
||||||
|
CPPUNIT_ASSERT_MESSAGE( "Failed to save " file, image.SaveFile(file) ); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
{ \
|
{ \
|
||||||
wxImage imageFromFile(file); \
|
wxImage imageFromFile(file); \
|
||||||
CPPUNIT_ASSERT_MESSAGE( "Failed to load " file, imageFromFile.IsOk() ); \
|
CPPUNIT_ASSERT_MESSAGE( "Failed to load " file, imageFromFile.IsOk() ); \
|
||||||
|