Fixed the MinGW ABI stuff again...
This commit is contained in:
parent
10aa198ac3
commit
538965b4ef
|
@ -11,7 +11,7 @@ void loadAreaSize(uiArea *a, ID2D1RenderTarget *rt, double *width, double *heigh
|
|||
if (!a->scrolling) {
|
||||
if (rt == NULL)
|
||||
rt = a->rt;
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
}
|
||||
|
|
|
@ -309,7 +309,18 @@ static void drawGrid(ID2D1RenderTarget *rt, D2D1_RECT_F *fillRect)
|
|||
// mind the divisions; they represent the fact the original uses a viewport
|
||||
size.width = 100 / 10;
|
||||
size.height = 100 / 10;
|
||||
// yay more ABI bugs
|
||||
#ifdef _MSC_VER
|
||||
pformat = rt->GetPixelFormat();
|
||||
#else
|
||||
{
|
||||
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *);
|
||||
GetPixelFormatF gpf;
|
||||
|
||||
gpf = (GetPixelFormatF) (&(rt->GetPixelFormat));
|
||||
(rt->*gpf)(&pformat);
|
||||
}
|
||||
#endif
|
||||
hr = rt->CreateCompatibleRenderTarget(&size, NULL,
|
||||
&pformat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE,
|
||||
&brt);
|
||||
|
@ -383,7 +394,7 @@ static void drawSVChooser(struct colorDialog *c, ID2D1RenderTarget *rt)
|
|||
ID2D1SolidColorBrush *markerBrush;
|
||||
HRESULT hr;
|
||||
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = size.width;
|
||||
|
@ -625,7 +636,7 @@ static void drawHSlider(struct colorDialog *c, ID2D1RenderTarget *rt)
|
|||
D2D1_POINT_2F center;
|
||||
HRESULT hr;
|
||||
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
rect.left = size.width / 6; // leftmost sixth for arrow
|
||||
rect.top = 0;
|
||||
rect.right = size.width;
|
||||
|
@ -712,7 +723,7 @@ static void drawPreview(struct colorDialog *c, ID2D1RenderTarget *rt)
|
|||
ID2D1SolidColorBrush *brush;
|
||||
HRESULT hr;
|
||||
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = size.width;
|
||||
|
@ -769,7 +780,7 @@ static void drawOpacitySlider(struct colorDialog *c, ID2D1RenderTarget *rt)
|
|||
D2D1_POINT_2F center;
|
||||
HRESULT hr;
|
||||
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = size.width;
|
||||
|
|
|
@ -56,7 +56,7 @@ static void d2dScratchDoLButtonDown(HWND hwnd, ID2D1RenderTarget *rt, LPARAM lPa
|
|||
pos.x = (xpix * 96) / dpix;
|
||||
pos.y = (ypix * 96) / dpiy;
|
||||
|
||||
size = rt->GetSize();
|
||||
size = realGetSize(rt);
|
||||
|
||||
SendMessageW(hwnd, msgD2DScratchLButtonDown, (WPARAM) (&pos), (LPARAM) (&size));
|
||||
}
|
||||
|
|
|
@ -386,8 +386,8 @@ static void fontDialogDrawSampleText(struct fontDialog *f, ID2D1RenderTarget *rt
|
|||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = rt->GetSize().width;
|
||||
rect.bottom = rt->GetSize().height;
|
||||
rect.right = realGetSize(rt).width;
|
||||
rect.bottom = realGetSize(rt).height;
|
||||
rt->DrawText(sample, wcslen(sample),
|
||||
format,
|
||||
&rect,
|
||||
|
|
|
@ -151,6 +151,8 @@ extern void getSizing(HWND hwnd, uiWindowsSizing *sizing, HFONT font);
|
|||
// graphemes.cpp
|
||||
extern size_t *graphemes(WCHAR *msg);
|
||||
|
||||
// TODO move into a dedicated file abibugs.cpp when we rewrite the drawing code
|
||||
extern D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -136,3 +136,19 @@ void invalidateRect(HWND hwnd, RECT *r, BOOL erase)
|
|||
if (InvalidateRect(hwnd, r, erase) == 0)
|
||||
logLastError(L"error invalidating window rect");
|
||||
}
|
||||
|
||||
// that damn ABI bug is never going to escape me is it
|
||||
D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return rt->GetSize();
|
||||
#else
|
||||
D2D1_SIZE_F size;
|
||||
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *);
|
||||
GetSizeF gs;
|
||||
|
||||
gs = (GetSizeF) (&(rt->GetSize));
|
||||
(rt->*gs)(&size);
|
||||
return size;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue