#334 libd2d1 GetSize()

open
nobody
5
2015-08-14
2013-03-31
No

Direct 2D sample: http://msdn.microsoft.com/en-us/library/windows/desktop/ff819062\(v=vs.85).aspx
Compiles and runs with Visual Studio 2012.
Program compiles but fails to run (Received a SIGSEGV: Segmentation fault) with GCC mingw-w64
Fails at BeginPaint(HWND hWnd,LPPAINTSTRUCT lpPaint);
Compiled with:
gcc version 4.8.0 (GCC)
mingw-w64 - revision 5706
See attached makefile
code url: http://go.microsoft.com/fwlink/?LinkId=195524
Running windows8 pro

Discussion

  • Richard Ebel

    Richard Ebel - 2013-03-31

    makefile

     
  • Richard Ebel

    Richard Ebel - 2013-03-31

    header

     
  • Richard Ebel

    Richard Ebel - 2013-03-31

    code

     
  • Richard Ebel

    Richard Ebel - 2013-03-31
    • summary: libd2d1 BeginPaint --> libd2d1 GetSize()
     
  • Richard Ebel

    Richard Ebel - 2013-03-31

    Actually fails because GetSize() returns an invalid client area size {width = 5.28816768e-037, height = 0}

     
  • Jonathan Yong

    Jonathan Yong - 2013-03-31

    The LPPAINTSTRUCT in mingw-w64 is probably buggy, can you compare the struct sizes in MSVC?
    sizeof(*lpPaint);

     
  • Richard Ebel

    Richard Ebel - 2013-04-02

    LPPAINTSTRUCT is 8 bytes for both MSVC and Mingw64

     
  • Richard Ebel

    Richard Ebel - 2013-04-02

    PAINTSTRUCT is 72 bytes for both MSVC and Mingw64

     
  • Jonathan Yong

    Jonathan Yong - 2013-04-03

    Hi,

    How is the structure initialized? Can you also do a binary compare via memcmp?
    Lastly, do compare with offsetof for each known struct member in PAINTSTRUCT.

    The BeginPaint call itself should be exactly identical to MSVC.

    Failing that, can you post the code itself AND the link command used? I might shift the blame to the HWND part if the struct part was identical.

     
  • Richard Ebel

    Richard Ebel - 2013-04-03

    BeginPaint(m_hwnd, lpps); fills in the paint structure.

    pRenderTarget->BeginDraw(); fails with Mingw64.

    See attached files for the MSVC paint structure, the Mingw64 paint structure, and the Mingw64 Debug window.

     
  • Jonathan Yong

    Jonathan Yong - 2013-04-03

    I don't mean that you should check the values, I mean the offsets of the struct members.

    From mingw-w64, you cam make a program that simply prints:
    printf("%d\n",offsetof(PAINTSTRUCT,hdc);
    printf("%d\n",offsetof(PAINTSTRUCT,fErase);
    and so on, do the same for MSVC, they should be identical.

     
  • Jonathan Yong

    Jonathan Yong - 2013-04-03

    Likewise, you may need to check ID2D1Factory and related structs.

     
  • Richard Ebel

    Richard Ebel - 2013-04-04

    printf("%d\n",offsetof(PAINTSTRUCT,hdc); = 0
    printf("%d\n",offsetof(PAINTSTRUCT,fErase); = 8
    The same for both MSVC and Mingw64
    I'm not sure about the offsets for ID2D1Factory and related structs.
    I have attached the debug output for MSVC and Mingw64 at the point where the interfaces are instantiated.
    see added files below

     
  • Jonathan Yong

    Jonathan Yong - 2013-04-05

    Can you test the offset for GetSize in ID2D1HwndRenderTarget too?
    All you can do now is to backtrack from the segfault and verify all the structures involved has the same alignment/offset.

    Sorry I couldn't reply earlier.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks