On 1/16/22 10:06, Vincent Torri wrote:
hello

On Sat, Jan 15, 2022 at 9:28 AM Vincent Torri <vincent.to...@gmail.com> wrote:
On Sat, Jan 15, 2022 at 7:43 AM Nikolay Sivov <nsi...@codeweavers.com> wrote:


On 1/14/22 23:05, Vincent Torri wrote:
On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov <nsi...@codeweavers.com> wrote:
on the contrary, CreateBitmap(), DrawBitmap(), BeginDraw(), EndDraw()
or SetTransform() are working with the C API.

Does someone have an idea of the problem. I have a test program if you want
It's a known thing, C-compatible prototypes would be different for such
methods:

D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
*size).
but then I have a compilation error because in d2d1.h provided by
mingw-w64, GetPixelSize() has only 1 argument, not 2.
Naturally, because headers are not prepared for that.

If you wanted to use C++ with msvc compatible prototypes, there is
WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
for C definitions it won't work, you'll have to use wine headers, or
more specifically a header widl produces from wine's d2d1.idl. Widl
detects such cases automatically, see is_aggregate_return() in widl sources.

I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for
C definitions patched in for mingw headers.
i've installed wine in archlinux, and
ID3D1HwndRenderTarget_GetPixelSize is defined with another macro, i
guess, which i don't know the value (no lucj with an fgrep -r in
/usr/include/wine

so i don't know the declaration of the function with d2d1.h provided with wine

Please take a closer look, there is a function wrapper called ID2D1HwndRenderTarget_GetPixelSize().

Also see attached patch, maybe that's enough to make it work for now.


Vincent Torri
From 88508f6dd75b80ce7e4fc40053f568449447476b Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsi...@codeweavers.com>
Date: Sun, 16 Jan 2022 12:13:25 +0300
Subject: [PATCH] d2d1: Fixup C method prototypes that are using aggregate
 return values.

Signed-off-by: Nikolay Sivov <nsi...@codeweavers.com>
---
 mingw-w64-headers/include/d2d1.h | 48 ++++++++++++++++----------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/mingw-w64-headers/include/d2d1.h b/mingw-w64-headers/include/d2d1.h
index 66f3ee4dc..3c5c570df 100644
--- a/mingw-w64-headers/include/d2d1.h
+++ b/mingw-w64-headers/include/d2d1.h
@@ -613,9 +613,9 @@ interface ID2D1Bitmap : public ID2D1Image {
 typedef struct ID2D1BitmapVtbl {
     ID2D1ImageVtbl Base;
 
-    STDMETHOD_(D2D1_SIZE_F, GetSize)(ID2D1Bitmap *This) PURE;
-    STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(ID2D1Bitmap *This) PURE;
-    STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(ID2D1Bitmap *This) PURE;
+    STDMETHOD_(D2D1_SIZE_F*, GetSize)(ID2D1Bitmap *This, D2D1_SIZE_T *__ret) 
PURE;
+    STDMETHOD_(D2D1_SIZE_U*, GetPixelSize)(ID2D1Bitmap *This, D2D1_SIZE_U 
*__ret) PURE;
+    STDMETHOD_(D2D1_PIXEL_FORMAT*, GetPixelFormat)(ID2D1Bitmap *This, 
D2D1_PIXEL_FORMAT *__ret) PURE;
     STDMETHOD_(void, GetDpi)(ID2D1Bitmap *This, FLOAT *dpiX, FLOAT *dpiY) PURE;
     STDMETHOD(CopyFromBitmap)(ID2D1Bitmap *This, const D2D1_POINT_2U 
*destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect) PURE;
     STDMETHOD(CopyFromRenderTarget)(ID2D1Bitmap *This, const D2D1_POINT_2U 
*destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect) PURE;
@@ -630,9 +630,9 @@ interface ID2D1Bitmap {
 #define ID2D1Bitmap_AddRef(this) 
(this)->lpVtbl->Base.Base.Base.AddRef((IUnknown*)(this))
 #define ID2D1Bitmap_Release(this) 
(this)->lpVtbl->Base.Base.Base.Release((IUnknown*)(this))
 #define ID2D1Bitmap_GetFactory(this,A) 
(this)->lpVtbl->Base.Base.GetFactory((ID2D1Resource*)(this),A)
-#define ID2D1Bitmap_GetSize(this) (this)->lpVtbl->GetSize(this)
-#define ID2D1Bitmap_GetPixelSize(this) (this)->lpVtbl->GetPixelSize(this)
-#define ID2D1Bitmap_GetPixelFormat(this) (this)->lpVtbl->GetPixelFormat(this)
+#define ID2D1Bitmap_GetSize(this,A) (this)->lpVtbl->GetSize(this,A)
+#define ID2D1Bitmap_GetPixelSize(this,A) (this)->lpVtbl->GetPixelSize(this,A)
+#define ID2D1Bitmap_GetPixelFormat(this,A) 
(this)->lpVtbl->GetPixelFormat(this,A)
 #define ID2D1Bitmap_GetDpi(this,A,B) (this)->lpVtbl->GetDpi(this,A,B)
 #define ID2D1Bitmap_CopyFromBitmap(this,A,B,C) 
(this)->lpVtbl->CopyFromBitmap(this,A,B,C)
 #define ID2D1Bitmap_CopyFromRenderTarget(this,A,B,C) 
(this)->lpVtbl->CopyFromRenderTarget(this,A,B,C)
@@ -980,11 +980,11 @@ typedef struct ID2D1RenderTargetVtbl {
     STDMETHOD_(void, Clear)(ID2D1RenderTarget *This, const D2D1_COLOR_F 
*clearColor) PURE;
     STDMETHOD_(void, BeginDraw)(ID2D1RenderTarget *This) PURE;
     STDMETHOD(EndDraw)(ID2D1RenderTarget *This, D2D1_TAG *tag1, D2D1_TAG 
*tag2) PURE;
-    STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(ID2D1RenderTarget *This) 
PURE;
+    STDMETHOD_(D2D1_PIXEL_FORMAT*, GetPixelFormat)(ID2D1RenderTarget *This, 
D2D1_PIXEL_FORMAT *__ret) PURE;
     STDMETHOD_(void, SetDpi)(ID2D1RenderTarget *This, FLOAT dpiX, FLOAT dpiY) 
PURE;
     STDMETHOD_(void, GetDpi)(ID2D1RenderTarget *This, FLOAT *dpiX, FLOAT 
*dpiY) PURE;
-    STDMETHOD_(D2D1_SIZE_F, GetSize)(ID2D1RenderTarget *This) PURE;
-    STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(ID2D1RenderTarget *This) PURE;
+    STDMETHOD_(D2D1_SIZE_F*, GetSize)(ID2D1RenderTarget *This, D2D1_SIZE_F 
*__ret) PURE;
+    STDMETHOD_(D2D1_SIZE_U*, GetPixelSize)(ID2D1RenderTarget *This, 
D2D1_SIZE_U *__ret) PURE;
     STDMETHOD_(UINT32, GetMaximumBitmapSize)(ID2D1RenderTarget *This) PURE;
     STDMETHOD_(BOOL, IsSupported)(ID2D1RenderTarget *This, const 
D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties) PURE;
 } ID2D1RenderTargetVtbl;
@@ -1030,9 +1030,9 @@ interface ID2D1RenderTarget {
 #define ID2D1RenderTarget_GetAntialiasMode(this) 
(this)->lpVtbl->GetAntialiasMode(this)
 #define ID2D1RenderTarget_GetDpi(this,A,B) (this)->lpVtbl->GetDpi(this,A,B)
 #define ID2D1RenderTarget_GetMaximumBitmapSize(this) 
(this)->lpVtbl->GetMaximumBitmapSize(this)
-#define ID2D1RenderTarget_GetPixelFormat(this) 
(this)->lpVtbl->GetPixelFormat(this)
-#define ID2D1RenderTarget_GetPixelSize(this) (this)->lpVtbl->GetPixelSize(this)
-#define ID2D1RenderTarget_GetSize(this) (this)->lpVtbl->GetSize(this)
+#define ID2D1RenderTarget_GetPixelFormat(this,A) 
(this)->lpVtbl->GetPixelFormat(this,A)
+#define ID2D1RenderTarget_GetPixelSize(this,A) 
(this)->lpVtbl->GetPixelSize(this,A)
+#define ID2D1RenderTarget_GetSize(this,A) (this)->lpVtbl->GetSize(this,A)
 #define ID2D1RenderTarget_GetTags(this,A,B) (this)->lpVtbl->GetTags(this,A,B)
 #define ID2D1RenderTarget_GetTextAntialiasMode(this) 
(this)->lpVtbl->GetTextAntialiasMode(this)
 #define ID2D1RenderTarget_GetTextRenderingParams(this,A) 
(this)->lpVtbl->GetTextRenderingParams(this,A)
@@ -1946,7 +1946,7 @@ interface ID2D1Layer : public ID2D1Resource {
 typedef struct ID2D1LayerVtbl {
     ID2D1ResourceVtbl Base;
 
-    STDMETHOD_(D2D1_SIZE_F, GetSize)(ID2D1Layer *This) PURE;
+    STDMETHOD_(D2D1_SIZE_F*, GetSize)(ID2D1Layer *This, D2D1_SIZE_F *__ret) 
PURE;
 } ID2D1LayerVtbl;
 
 interface ID2D1Layer {
@@ -1957,7 +1957,7 @@ interface ID2D1Layer {
 #define ID2D1Layer_AddRef(this) 
(this)->lpVtbl->Base.Base.AddRef((IUnknown*)(this))
 #define ID2D1Layer_Release(this) 
(this)->lpVtbl->Base.Base.Release((IUnknown*)(this))
 #define ID2D1Layer_GetFactory(this,A) 
(this)->lpVtbl->Base.GetFactory((ID2D1Resource*)(this),A)
-#define ID2D1Layer_GetSize(this) (this)->lpVtbl->GetSize(this)
+#define ID2D1Layer_GetSize(this,A) (this)->lpVtbl->GetSize(this,A)
 
 #endif
 
@@ -2001,8 +2001,8 @@ typedef struct ID2D1LinearGradientBrushVtbl {
 
     STDMETHOD_(void, SetStartPoint)(ID2D1LinearGradientBrush *This, 
D2D1_POINT_2F startPoint) PURE;
     STDMETHOD_(void, SetEndPoint)(ID2D1LinearGradientBrush *This, 
D2D1_POINT_2F endPoint) PURE;
-    STDMETHOD_(D2D1_POINT_2F, GetStartPoint)(ID2D1LinearGradientBrush *This) 
PURE;
-    STDMETHOD_(D2D1_POINT_2F, GetEndPoint)(ID2D1LinearGradientBrush *This) 
PURE;
+    STDMETHOD_(D2D1_POINT_2F*, GetStartPoint)(ID2D1LinearGradientBrush *This, 
D2D1_POINT_2F *__ret) PURE;
+    STDMETHOD_(D2D1_POINT_2F*, GetEndPoint)(ID2D1LinearGradientBrush *This, 
D2D1_POINT_2F *__ret) PURE;
     STDMETHOD_(void, GetGradientStopCollection)(ID2D1LinearGradientBrush 
*This, ID2D1GradientStopCollection **gradientStopCollection) PURE;
 } ID2D1LinearGradientBrushVtbl;
 
@@ -2018,9 +2018,9 @@ interface ID2D1LinearGradientBrush {
 #define ID2D1LinearGradientBrush_SetTransform(this,A) 
(this)->lpVtbl->Base.SetTransform((ID2D1Brush*)(this),A)
 #define ID2D1LinearGradientBrush_GetOpacity(this) 
(this)->lpVtbl->Base.GetOpacity((ID2D1Brush*)(this))
 #define ID2D1LinearGradientBrush_GetTransform(this,A) 
(this)->lpVtbl->Base.GetTransform((ID2D1Brush*)(this),A)
-#define ID2D1LinearGradientBrush_GetEndPoint(this) 
(this)->lpVtbl->GetEndPoint(this)
+#define ID2D1LinearGradientBrush_GetEndPoint(this,A) 
(this)->lpVtbl->GetEndPoint(this,A)
 #define ID2D1LinearGradientBrush_GetGradientStopCollection(this,A) 
(this)->lpVtbl->GetGradientStopCollection(this,A)
-#define ID2D1LinearGradientBrush_GetStartPoint(this) 
(this)->lpVtbl->GetStartPoint(this)
+#define ID2D1LinearGradientBrush_GetStartPoint(this,A) 
(this)->lpVtbl->GetStartPoint(this,A)
 #define ID2D1LinearGradientBrush_SetEndPoint(this,A) 
(this)->lpVtbl->SetEndPoint(this,A)
 #define ID2D1LinearGradientBrush_SetStartPoint(this,A) 
(this)->lpVtbl->SetStartPoint(this,A)
 
@@ -2152,8 +2152,8 @@ typedef struct ID2D1RadialGradientBrushVtbl {
     STDMETHOD_(void, SetGradientOriginOffset)(ID2D1RadialGradientBrush *This, 
D2D1_POINT_2F gradientOriginOffset) PURE;
     STDMETHOD_(void, SetRadiusX)(ID2D1RadialGradientBrush *This, FLOAT 
radiusX) PURE;
     STDMETHOD_(void, SetRadiusY)(ID2D1RadialGradientBrush *This, FLOAT 
radiusY) PURE;
-    STDMETHOD_(D2D1_POINT_2F, GetCenter)(ID2D1RadialGradientBrush *This) PURE;
-    STDMETHOD_(D2D1_POINT_2F, 
GetGradientOriginOffset)(ID2D1RadialGradientBrush *This) PURE;
+    STDMETHOD_(D2D1_POINT_2F*, GetCenter)(ID2D1RadialGradientBrush *This, 
D2D1_POINT_2F *__ret) PURE;
+    STDMETHOD_(D2D1_POINT_2F*, 
GetGradientOriginOffset)(ID2D1RadialGradientBrush *This, D2D1_POINT_2F *__ret) 
PURE;
     STDMETHOD_(FLOAT, GetRadiusX)(ID2D1RadialGradientBrush *This) PURE;
     STDMETHOD_(FLOAT, GetRadiusY)(ID2D1RadialGradientBrush *This) PURE;
     STDMETHOD_(void, GetGradientStopCollection)(ID2D1RadialGradientBrush 
*This, ID2D1GradientStopCollection **gradientStopCollection) PURE;
@@ -2171,8 +2171,8 @@ interface ID2D1RadialGradientBrush {
 #define ID2D1RadialGradientBrush_SetTransform(this,A) 
(this)->lpVtbl->Base.SetTransform((ID2D1Brush*)(this),A)
 #define ID2D1RadialGradientBrush_GetOpacity(this) 
(this)->lpVtbl->Base.GetOpacity((ID2D1Brush*)(this))
 #define ID2D1RadialGradientBrush_GetTransform(this,A) 
(this)->lpVtbl->Base.GetTransform((ID2D1Brush*)(this),A)
-#define ID2D1RadialGradientBrush_GetCenter(this) 
(this)->lpVtbl->GetCenter(this)
-#define ID2D1RadialGradientBrush_GetGradientOriginOffset(this) 
(this)->lpVtbl->GetGradientOriginOffset(this)
+#define ID2D1RadialGradientBrush_GetCenter(this,A) 
(this)->lpVtbl->GetCenter(this,A)
+#define ID2D1RadialGradientBrush_GetGradientOriginOffset(this,A) 
(this)->lpVtbl->GetGradientOriginOffset(this,A)
 #define ID2D1RadialGradientBrush_GetGradientStopCollection(this,A) 
(this)->lpVtbl->GetGradientStopCollection(this,A)
 #define ID2D1RadialGradientBrush_GetRadiusX(this) 
(this)->lpVtbl->GetRadiusX(this)
 #define ID2D1RadialGradientBrush_GetRadiusY(this) 
(this)->lpVtbl->GetRadiusY(this)
@@ -2294,7 +2294,7 @@ typedef struct ID2D1SolidColorBrushVtbl {
     ID2D1BrushVtbl Base;
 
     STDMETHOD_(void, SetColor)(ID2D1SolidColorBrush *This, const D2D1_COLOR_F 
*color) PURE;
-    STDMETHOD_(D2D1_COLOR_F, GetColor)(ID2D1SolidColorBrush *This) PURE;
+    STDMETHOD_(D2D1_COLOR_F*, GetColor)(ID2D1SolidColorBrush *This, 
D2D1_COLOR_F *__ret) PURE;
 } ID2D1SolidColorBrushVtbl;
 
 interface ID2D1SolidColorBrush {
@@ -2309,7 +2309,7 @@ interface ID2D1SolidColorBrush {
 #define ID2D1SolidColorBrush_SetTransform(this,A) 
(this)->lpVtbl->Base.SetTransform((ID2D1Brush*)(this),A)
 #define ID2D1SolidColorBrush_GetOpacity(this) 
(this)->lpVtbl->Base.GetOpacity((ID2D1Brush*)(this))
 #define ID2D1SolidColorBrush_GetTransform(this,A) 
(this)->lpVtbl->Base.GetTransform((ID2D1Brush*)(this),A)
-#define ID2D1SolidColorBrush_GetColor(this) (this)->lpVtbl->GetColor(this)
+#define ID2D1SolidColorBrush_GetColor(this,A) (this)->lpVtbl->GetColor(this,A)
 #define ID2D1SolidColorBrush_SetColor(this,A) (this)->lpVtbl->SetColor(this,A)
 
 #endif
-- 
2.34.1

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to