mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
libui/windows: some work on hiDPI shit
still looks derpy but atleast the rendering and touchscreen aren't broken
This commit is contained in:
@ -26,6 +26,16 @@ static HRESULT doPaint(uiArea *a, ID2D1RenderTarget *rt, RECT *clip)
|
||||
|
||||
rt->BeginDraw();
|
||||
|
||||
{
|
||||
float dpi_x, dpi_y;
|
||||
D2D1_MATRIX_3X2_F dm;
|
||||
rt->GetDpi(&dpi_x, &dpi_y);
|
||||
ZeroMemory(&dm, sizeof (D2D1_MATRIX_3X2_F));
|
||||
dm._11 = 96.f/dpi_x;
|
||||
dm._22 = 96.f/dpi_y;
|
||||
rt->SetTransform(&dm);
|
||||
}
|
||||
|
||||
if (a->scrolling) {
|
||||
ZeroMemory(&scrollTransform, sizeof (D2D1_MATRIX_3X2_F));
|
||||
scrollTransform._11 = 1;
|
||||
|
@ -101,7 +101,7 @@ static void areaMouseEvent(uiArea *a, int down, int up, WPARAM wParam, LPARAM l
|
||||
xpix = (double) GET_X_LPARAM(lParam);
|
||||
ypix = (double) GET_Y_LPARAM(lParam);
|
||||
// these are in pixels; we need points
|
||||
pixelsToDIP(a, &xpix, &ypix);
|
||||
//pixelsToDIP(a, &xpix, &ypix);
|
||||
me.X = xpix;
|
||||
me.Y = ypix;
|
||||
if (a->scrolling) {
|
||||
|
@ -14,6 +14,7 @@ void loadAreaSize(uiArea *a, ID2D1RenderTarget *rt, double *width, double *heigh
|
||||
size = realGetSize(rt);
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
dipToPixels(a, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,6 +560,13 @@ void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRe
|
||||
D2D_RECT_F _srcrect = D2D1::RectF(srcrect->X, srcrect->Y, srcrect->X+srcrect->Width, srcrect->Y+srcrect->Height);
|
||||
D2D_RECT_F _dstrect = D2D1::RectF(dstrect->X, dstrect->Y, dstrect->X+dstrect->Width, dstrect->Y+dstrect->Height);
|
||||
|
||||
float dpix, dpiy;
|
||||
c->rt->GetDpi(&dpix, &dpiy);
|
||||
_srcrect.left = (_srcrect.left * 96.0f) / dpix;
|
||||
_srcrect.top = (_srcrect.top * 96.0f) / dpiy;
|
||||
_srcrect.right = (_srcrect.right * 96.0f) / dpix;
|
||||
_srcrect.bottom = (_srcrect.bottom * 96.0f) / dpiy;
|
||||
|
||||
c->rt->DrawBitmap(bmp->bmp, &_dstrect, 1.0f, filter ? D2D1_BITMAP_INTERPOLATION_MODE_LINEAR : D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &_srcrect);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ const char *uiInit(uiInitOptions *o)
|
||||
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
|
||||
nCmdShow = si.wShowWindow;
|
||||
|
||||
// LONGTERM set DPI awareness
|
||||
SetProcessDPIAware();
|
||||
|
||||
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
|
||||
if (hDefaultIcon == NULL)
|
||||
|
Reference in New Issue
Block a user