1. libgd
  2. Untitled project
  3. gd-libgd

Issues

Issue #12 resolved

gdImageCopyResampled broken when built with Visual C++ 2010 32-bit due to floor2() "smart" cast

Xavier Roche
created an issue

The gdImageCopyResampled() function is broken when built with Visual C++ 2010 32-bit (with full optimization, -O2) due to floor2() "smart" cast. The result is generally a white image with colored artifacts, rather than the re-sampled image.

This is most probably a compiler optimization bug, so this is not directly a GD bug. But I open the ticket for people who might get similar troubles :)

The bug is triggered by the following line in gd.c: sx = floor2 (sx);

Possible fix is to do the following in gd.c:

{{{

if (defined(_WIN32) && defined(_M_IX86) && defined(_MSC_VER) && _MSC_VER == 1600)

/ Do not use optimized version due to possible compiler bug with VC++2010/ix86. /

define floor2(exp) floor(exp)

else

define floor2(exp) ((long) (exp))

endif

}}}

Comments (7)

  1. Log in to comment