#462 GDI+: PixelFormat* broken without "using namespace Gdiplus"

closed-accepted
w32api (251)
2010-12-27
2010-10-10
No

The folks over at the Allegro project have trouble compiling their code with the GDI+ headers provided by MinGW; see this forum entry: <http://www.allegro.cc/forums/thread/605136/883924#target>. The error messages reveal that this is caused by an incorrect definition of the PixelFormat... constants in gdipluspixelformats.h. In particular, Allegro's code

if (!gdi_bmp->LockBits(&rect, Gdiplus::ImageLockModeWrite,
PixelFormat32bppARGB, gdi_lock))

expands to

if (!gdi_bmp->LockBits(&rect, Gdiplus::ImageLockModeWrite,
((PixelFormat) (...)), gdi_lock))

which, since there is a typedef Gdiplus::PixelFormat (for INT) but no namespace-less PixelFormat, breaks apart when "using namespace Gdiplus" is not being used. This patch changes the definition of all PixelFormat... constants such that the cast is done to (for simplicity) INT. An equivalent option would have been to cast to Gdiplus::PixelFormat.

A small test case is attached which can't be compiled with w32api headers from CVS but works after the patch is applied. I have also verified that all tests from <https://sourceforge.net/tracker/?func=detail&aid=3007314&group_id=2435&atid=302435> still compile and work as expected.

Discussion

  • Markus Koenig

    Markus Koenig - 2010-10-10

    Patchset

     
  • Markus Koenig

    Markus Koenig - 2010-10-10

    ChangeLog entry

     
  • Markus Koenig

    Markus Koenig - 2010-10-10

    Test case

     
  • Chris Sutcliffe

    Chris Sutcliffe - 2010-12-27
    • assigned_to: nobody --> ir0nh34d
    • status: open --> closed-accepted
     
  • Chris Sutcliffe

    Chris Sutcliffe - 2010-12-27

    Your patch has been accepted and is now commited to CVS. You should expect to see it in the next release.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks