Le 2012-02-04 14:34, Rafaël Carré a écrit : > Hello, > > ID2D1RenderTarget interface (inherited by ID2D1HwndRenderTarget) is > currently incorrect and crashes VLC Direct2D video output. > > ID2D1HwndRenderTarget is thus correctly marked as invalid using > __MINGW_POISON_NAME -> > _layout_has_not_been_verified_and_its_declaration_is_most_likely_incorrect > > The interface is documented on > http://msdn.microsoft.com/en-us/library/windows/desktop/dd371766(v=vs.85).aspx > but the order of interface members is probably incorrect. On MSDN the > functions are sorted alphabetically. > > I read Microsoft SDK v7.1 header to extract the exact order of members:
I will try to be more clear about what I did: I opened Microsoft SDK's d2d1.h and searched for ID2D1RenderTarget interface. I scrolled down through the whole interface and wrote the function names (and only the names) in my mail client, in the order I saw them. I did not look at function arguments or return value, since those are already defined in MSDN. Then I press send, and close Microsoft SDK's d2d1.h from my text editor. After that I opened my email, and I opened mingw-w64's d2d1.h, I looked for ID2D1RenderTarget interface to correct it, by swapping the functions in the order I saw them in my mail. I quickly saw that this interface was already correct. I copied the list of functions of ID2D1RenderTarget *of mingw-w64's d2d1.h* and pasted it in ID2D1HwndRenderTarget interface, replacing the bogus order. Then I replaced "ID2D1RenderTarget *This" by ID2D1HwndRenderTarget *This". After that I built VLC again, and saw that Resize() function returned an error: "Cannot resize render target (width = %d, height = %d, hr = 0x%x)!" Thus I opened Microsoft SDK's d2d1.h again, and saw that the order of functions for ID2D1HwndRenderTarget specific interface is: CheckWindowState Resize GetHwnd Thus I swapped GetHwnd and Resize in our interface, rebuilt VLC and found that direct2d output was working. The ID2D1HwndRenderTarget interface for C++ is different due to functions overloading. I did not look at this interface at all and did not try to implement it since VLC uses the C interface. I didn't copy anything from Microsoft header, you can verify this in d2d1.h: The text for ID2D1RenderTarget interface in the definition of ID2D1RenderTarget and ID2D1HwndRenderTarget is identical except for the type of This pointer. The text for ID2D1HwndRenderTarget specific interface is also identical, only 2 lines were swapped (GetHwnd and Resize). Please ask if you need more details. > > CreateBitmap > CreateBitmapFromWicBitmap > CreateSharedBitmap > CreateBitmapBrush > CreateSolidColorBrush > CreateGradientStopCollection > CreateLinearGradientBrush > CreateRadialGradientBrush > CreateCompatibleRenderTarget > CreateLayer > CreateMesh > DrawLine > DrawRectangle > FillRectangle > DrawRoundedRectangle > FillRoundedRectangle > DrawEllipse > FillEllipse > DrawGeometry > FillGeometry > FillMesh > FillOpacityMask > DrawBitmap > DrawText > DrawTextLayout > DrawGlyphRun > SetTransform > GetTransform > SetAntialiasMode > GetAntialiasMode > SetTextAntialiasMode > GetTextAntialiasMode > SetTextRenderingParams > GetTextRenderingParams > SetTags > GetTags > PushLayer > PopLayer > Flush > SaveDrawingState > RestoreDrawingState > PushAxisAlignedClip > PopAxisAlignedClip > Clear > BeginDraw > EndDraw > GetPixelFormat > SetDpi > GetDpi > GetSize > GetPixelSize > GetMaximumBitmapSize > IsSupported ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
