]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Filter update.
authorToni Wilen <twilen@winuae.net>
Mon, 24 Mar 2025 17:02:11 +0000 (19:02 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 24 Mar 2025 17:02:11 +0000 (19:02 +0200)
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/gdirender.cpp
od-win32/win32_scaler.cpp

index f79608f8986d4103920c39eeeec47043f7175882..6866f0318c9be7abfe475de7b919367f87559458 100644 (file)
@@ -2101,8 +2101,8 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender, int monid
 
        float dw = (float)ds.dstwidth;
        float dh = (float)ds.dstheight;
-       float w = ds.outwidth;
-       float h = ds.outheight;
+       float w = (float)ds.outwidth;
+       float h = (float)ds.outheight;
 
        d3d->fakesize.x = w;
        d3d->fakesize.y = h;
index d181b162896b34a96dce7534ac8586da8c46d4a4..edd06db5d4361c1105e89b5dfd652865d49ed5cd 100644 (file)
@@ -1581,8 +1581,8 @@ static void setupscenecoords(struct d3d11struct *d3d, bool normalrender, int mon
        float sw = dw / d3d->m_screenWidth;
        float sh = dh / d3d->m_screenHeight;
 
-       int xshift = -ds.xoffset;
-       int yshift = -ds.yoffset;
+       float xshift = (float)-ds.xoffset;
+       float yshift = (float)-ds.yoffset;
 
        xshift -= (w - d3d->m_screenWidth) / 2;
        yshift -= (h - d3d->m_screenHeight) / 2;
@@ -5055,8 +5055,6 @@ static bool xD3D11_alloctexture(int monid, int w, int h)
                D3D_unlocktexture(monid, -1, -1);
        }
 
-       recheck(d3d, monid);
-
        if (d3d->invalidmode || !d3d->m_device) {
                return false;
        }
@@ -5069,6 +5067,8 @@ static bool xD3D11_alloctexture(int monid, int w, int h)
        d3d->m_bitmapWidthX = d3d->m_bitmapWidth * d3d->dmultxh;
        d3d->m_bitmapHeightX = d3d->m_bitmapHeight * d3d->dmultxv;
 
+       recheck(d3d, monid);
+
        v = CreateTexture(d3d);
        if (!v)
                return false;
index 51d937edf6c64e49ff7972ef81655a88a011530b..e8340ab537146b6868dd4f8bb0bf7039f1cf00a0 100644 (file)
@@ -95,20 +95,20 @@ static void setupscenecoords(struct gdistruct *gdi, int monid)
        float w = (float)ds.outwidth;
        float h = (float)ds.outheight;
 
-       int tx = (dw * gdi->bm.width) / (gdi->wwidth * 2);
-       int ty = (dh * gdi->bm.height) / (gdi->wheight * 2);
+       float tx = (dw * gdi->bm.width) / (gdi->wwidth * 2);
+       float ty = (dh * gdi->bm.height) / (gdi->wheight * 2);
 
        float sw = dw / gdi->wwidth;
        float sh = dh / gdi->wheight;
 
-       int xshift = -ds.xoffset;
-       int yshift = -ds.yoffset;
+       float xshift = (float)-ds.xoffset;
+       float yshift = (float)-ds.yoffset;
 
        xshift -= (w - gdi->wwidth) / 2;
        yshift -= (h - gdi->wheight) / 2;
 
-       gdi->xoffset = tx + xshift - gdi->wwidth / 2;
-       gdi->yoffset = ty + yshift - gdi->wheight / 2;
+       gdi->xoffset = (int)(tx + xshift - gdi->wwidth / 2);
+       gdi->yoffset = (int)(ty + yshift - gdi->wheight / 2);
 
        gdi->xmult = filterrectmult(gdi->wwidth, w, gdi->dmode);
        gdi->ymult = filterrectmult(gdi->wheight, h, gdi->dmode);
index d27f2651ff2c958593e640a20c42c6569a60caf0..4e6d13544a9f88645de5f4f827cd009a1f1210d1 100644 (file)
@@ -201,8 +201,6 @@ void getfilterdata(int monid, struct displayscale *ds)
 
        store_custom_limits (-1, -1, -1, -1);
        ds->mode = 0;
-       ds->outwidth = ds->srcwidth;
-       ds->outheight = ds->srcheight;
 
        if (mon->screen_is_picasso) {
                getrtgfilterdata(monid, ds);
@@ -288,6 +286,9 @@ void getfilterdata(int monid, struct displayscale *ds)
                filterxmult = (float)ds->scale;
                filterymult = (float)ds->scale;
 
+               ds->xoffset = 0;
+               ds->yoffset = 0;
+
                if (scalemode == AUTOSCALE_STATIC_MAX || scalemode == AUTOSCALE_STATIC_NOMINAL ||
                        scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
 
@@ -395,8 +396,8 @@ void getfilterdata(int monid, struct displayscale *ds)
                                                        mult += multadd;
                                                }
                                                float multx = mult, multy = mult;
-                                               maxw = maxw * mult;
-                                               maxh = maxh * mult;
+                                               maxw = (int)(maxw * mult);
+                                               maxh = (int)(maxh * mult);
                                        } else {
                                                while (((cw2 * (mult + multadd)) / m) - adjw <= maxw && ch2 * (mult + multadd) - adjh <= maxh) {
                                                        mult += multadd;
@@ -411,8 +412,8 @@ void getfilterdata(int monid, struct displayscale *ds)
                                                if (ch2 * (mult * 2) - adjh <= maxh && cw2 > ch2 * 2.4) {
                                                        multy *= 2;
                                                }
-                                               maxw = (maxw + mult - multadd) / mult;
-                                               maxh = (maxh + mult - multadd) / mult;
+                                               maxw = (int)((maxw + mult - multadd) / mult);
+                                               maxh = (int)((maxh + mult - multadd) / mult);
                                        }
                                }
 
@@ -611,14 +612,21 @@ void getfilterdata(int monid, struct displayscale *ds)
                        ds->xoffset += (int)(-filter_horiz_offset * aws);
                        ds->yoffset += (int)(-filter_vert_offset * ahs);
 
-                       diff = ds->dstwidth;
+                       diff = ds->outwidth;
                        filterxmult = ((float)ds->dstwidth * ds->scale) / diff;
-                       diff = ds->dstheight;
+                       diff = ds->outheight;
                        filterymult = ((float)ds->dstheight * ds->scale) / diff;
 
                        goto end;
                }
 
+       } else {
+       
+               ds->outwidth = ds->dstwidth;
+               ds->outheight = ds->dstheight;
+               ds->xoffset = (ds->srcwidth - ds->dstwidth) / 2;
+               ds->yoffset = (ds->srcheight - ds->dstheight) / 2;
+
        }
 cont: