]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Scaling filtering cleanup
authorToni Wilen <twilen@winuae.net>
Sat, 22 Mar 2025 14:29:13 +0000 (16:29 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 22 Mar 2025 14:29:13 +0000 (16:29 +0200)
include/gfxfilter.h
od-win32/avioutput.cpp
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/gdirender.cpp
od-win32/screenshot.cpp
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gfx.h

index 0ef3f57811fed56b5705fd1a65b69b087a5cd0e0..942d859427f4ecf621f0d63c351736044a9194cc 100644 (file)
@@ -5,20 +5,32 @@
 
 #ifdef GFXFILTER
 
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned long u32;
-
-void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int *mode, int temp_width, int temp_height);
+struct displayscale
+{
+       // max output size
+       int dstwidth, dstheight;
+       // input bitmap size
+       int srcwidth, srcheight;
+       // output size
+       int outwidth, outheight;
+
+       int mx, my;
+       float mmx, mmy;
+       int xoffset, yoffset;
+       int mode;
+       int scale;
+};
+
+void getfilterdata(int monid, struct displayscale *ds);
 void getfilteroffset(int monid, float *dx, float *dy, float *mx, float *my);
 
-uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth);
-void freefilterbuffer(int monid, uae_u8*);
+uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, bool *locked);
+void freefilterbuffer(int monid, uae_u8*, bool unlock);
 
 uae_u8 *uaegfx_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
 void uaegfx_freertgbuffer(int monid, uae_u8 *dst);
 
-extern void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int dst_width, int dst_height);
+extern void getrtgfilterdata(int monid, struct displayscale *ds);
 extern float filterrectmult(int v1, float v2, int dmode);
 
 #endif /* GFXFILTER */
index a1c335a342054eef3a6c1f597824fd13e604ad91..1474edd07a0a3e7fa5c1a274f177d6e40ae21b9a 100644 (file)
@@ -532,6 +532,8 @@ void AVIOutput_ReleaseVideo(void)
 static int AVIOutput_AllocateVideo(void)
 {
        struct AmigaMonitor *mon = &AMonitors[aviout_monid];
+       bool locked = false;
+
        avioutput_width = avioutput_height = avioutput_bits = 0;
        aviout_width_out = aviout_height_out = 0;
        aviout_xoffset_out = aviout_yoffset_out = 0;
@@ -542,7 +544,8 @@ static int AVIOutput_AllocateVideo(void)
        if (avioutput_originalsize || WIN32GFX_IsPicassoScreen(mon)) {
                int pitch;
                if (!gfxboard_isgfxboardscreen(0)) {
-                       getfilterbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits);
+                       uae_u8 *p = getfilterbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits, &locked);
+                       freefilterbuffer(0, p, locked);
                } else {
                        gfxboard_freertgbuffer(0, gfxboard_getrtgbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits, NULL));
                }
@@ -1100,14 +1103,14 @@ void AVIOutput_RGBinfo (int rb, int gb, int bb, int ab, int rs, int gs, int bs,
 }
 
 #if defined (GFXFILTER)
-extern uae_u8 *bufmem_ptr;
 
 static int getFromBuffer(struct avientry *ae, int original)
 {
        struct AmigaMonitor *mon = &AMonitors[aviout_monid];
        struct vidbuf_description *vidinfo = &adisplays[aviout_monid].gfxvidinfo;
        int x, y, w, h, d;
-       uae_u8 *src, *mem;
+       bool locked = false;
+       uae_u8 *src = NULL, *mem;
        uae_u8 *dst = ae->lpVideo;
        int spitch, dpitch;
        int maxw, maxh;
@@ -1116,7 +1119,7 @@ static int getFromBuffer(struct avientry *ae, int original)
        dpitch = ((aviout_width_out * avioutput_bits + 31) & ~31) / 8;
        if (original || WIN32GFX_IsPicassoScreen(mon)) {
                if (!gfxboard_isgfxboardscreen(aviout_monid)) {
-                       src = getfilterbuffer(aviout_monid, &w, &h, &spitch, &d);
+                       src = getfilterbuffer(aviout_monid, &w, &h, &spitch, &d, &locked);
                        maxw = vidinfo->outbuffer->outwidth;
                        maxh = vidinfo->outbuffer->outheight;
                } else {
@@ -1124,11 +1127,6 @@ static int getFromBuffer(struct avientry *ae, int original)
                        maxw = w;
                        maxh = h;
                }
-       } else {
-               spitch = vidinfo->outbuffer->rowbytes;
-               src = bufmem_ptr;
-               maxw = vidinfo->outbuffer->outwidth;
-               maxh = vidinfo->outbuffer->outheight;
        }
        if (!src)
                return 0;
index 83ffb3fdb89e6f578f802da6c995ed3785a12f42..aff85ef89ec08c7f36a4946ebcf172fad51a0e65 100644 (file)
@@ -213,7 +213,6 @@ struct d3dstruct
        float xmult, ymult;
        bool cursor_v, cursor_scale;
        int statusbar_vx, statusbar_hx;
-       RECT sr2, dr2, zr2;
 
        struct gfx_filterdata *filterd3d;
        int filterd3didx;
@@ -2095,34 +2094,23 @@ static bool xD3D_getscalerect(int monid, float *mx, float *my, float *sx, float
 static void setupscenecoords(struct d3dstruct *d3d, bool normalrender, int monid)
 {
        struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo;
-       RECT sr, dr, zr;
-       float w, h;
-       float dw, dh;
-       static RECT sr2[MAX_AMIGAMONITORS], dr2[MAX_AMIGAMONITORS], zr2[MAX_AMIGAMONITORS];
+       struct displayscale ds = { 0 };
 
        if (!normalrender)
                return;
 
-       getfilterrect2 (monid, &dr, &sr, &zr, d3d->window_w, d3d->window_h, d3d->tin_w / d3d->dmult, d3d->tin_h / d3d->dmult, d3d->dmult, &d3d->dmode, d3d->tin_w, d3d->tin_h);
+       ds.srcwidth = d3d->tin_w / d3d->dmult;
+       ds.srcheight = d3d->tin_h / d3d->dmult;
+       ds.scale = d3d->dmult;
+       ds.dstwidth = d3d->window_w;
+       ds.dstheight = d3d->window_h;
 
-       if (memcmp (&sr, &sr2[monid], sizeof RECT) || memcmp (&dr, &dr2[monid], sizeof RECT) || memcmp (&zr, &zr2[monid], sizeof RECT)) {
-               write_log (_T("POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d)\n"),
-                       dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom,
-                       sr.right - sr.left, sr.bottom - sr.top,
-                       zr.left, zr.top);
-               sr2[monid] = sr;
-               dr2[monid] = dr;
-               zr2[monid] = zr;
-       }
-
-       d3d->sr2 = sr;
-       d3d->dr2 = dr;
-       d3d->zr2 = zr;
+       getfilterdata(monid, &ds);
 
-       dw = (float)dr.right - dr.left;
-       dh = (float)dr.bottom - dr.top;
-       w = (float)sr.right - sr.left;
-       h = (float)sr.bottom - sr.top;
+       float dw = (float)ds.dstwidth;
+       float dh = (float)ds.dstheight;
+       float w = ds.outwidth;
+       float h = ds.outheight;
 
        d3d->fakesize.x = w;
        d3d->fakesize.y = h;
@@ -2131,48 +2119,17 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender, int monid
 
        MatrixOrthoOffCenterLH (&d3d->m_matProj_out, 0, w + 0.05f, 0, h + 0.05f, 0.0f, 1.0f);
 
-       float tx, ty;
-       float sw, sh;
-
-       if (0 && d3d->mask2texture) {
-
-               float mw = (float)d3d->mask2rect.right - d3d->mask2rect.left;
-               float mh = (float)d3d->mask2rect.bottom - d3d->mask2rect.top;
-
-               tx = -0.5f + dw * d3d->tin_w / mw / 2;
-               ty = +0.5f + dh * d3d->tin_h / mh / 2;
-
-               float xshift = (float)-zr.left;
-               float yshift = (float)-zr.top;
-
-               sw = dw * d3d->tin_w / vidinfo->outbuffer->inwidth2;
-               sw *= mw / d3d->window_w;
-
-               tx = -0.5f + d3d->window_w / 2;
+       float tx = -0.5f + dw * d3d->tin_w / d3d->window_w / 2;
+       float ty = +0.5f + dh * d3d->tin_h / d3d->window_h / 2;
 
-               sh = dh * d3d->tin_h / vidinfo->outbuffer->inheight2;
-               sh *= mh / d3d->window_h;
-
-               ty = +0.5f + d3d->window_h / 2;
-
-               tx += xshift;
-               ty += yshift;
-
-       } else {
-
-               tx = -0.5f + dw * d3d->tin_w / d3d->window_w / 2;
-               ty = +0.5f + dh * d3d->tin_h / d3d->window_h / 2;
-
-               float xshift = (float)(- zr.left - sr.left); // - (tin_w - 2 * zr.left - w),
-               float yshift = (float)(+ zr.top + sr.top - (d3d->tin_h - h));
+       float xshift = (float)(-ds.xoffset); // - (tin_w - 2 * zr.left - w),
+       float yshift = (float)(ds.yoffset - (d3d->tin_h - h));
        
-               sw = dw * d3d->tin_w / d3d->window_w;
-               sh = dh * d3d->tin_h / d3d->window_h;
+       float sw = dw * d3d->tin_w / d3d->window_w;
+       float sh = dh * d3d->tin_h / d3d->window_h;
 
-               tx += xshift;
-               ty += yshift;
-
-       }
+       tx += xshift;
+       ty += yshift;
 
        d3d->xmult = filterrectmult(d3d->window_w, w, d3d->dmode);
        d3d->ymult = filterrectmult(d3d->window_h, h, d3d->dmode);
@@ -2192,8 +2149,8 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender, int monid
                d3d->m_matWorld_out = tmprmatrix;
        }
 
-       d3d->cursor_offset_x = -zr.left;
-       d3d->cursor_offset_y = -zr.top;
+       d3d->cursor_offset_x = -ds.xoffset;
+       d3d->cursor_offset_y = -ds.yoffset;
 
        //write_log (_T("%.1fx%.1f %.1fx%.1f %.1fx%.1f\n"), dw, dh, w, h, sw, sh);
 
index 592812c1f6d8035490936573cd278994de100b1d..e49e0dfecb2419efc0ed24c9e15dccaeafd775ac 100644 (file)
@@ -309,7 +309,6 @@ struct d3d11struct
        IDXGISurface1 *hdc_surface;
        HANDLE filenotificationhandle;
 
-       RECT sr2, dr2, zr2;
        int guimode;
        int delayedfs;
        int device_errors;
@@ -1558,50 +1557,38 @@ static bool UpdateBuffers(struct d3d11struct *d3d, int monid)
 
 static void setupscenecoords(struct d3d11struct *d3d, bool normalrender, int monid)
 {
-       RECT sr, dr, zr;
-       static RECT sr2[MAX_AMIGAMONITORS], dr2[MAX_AMIGAMONITORS], zr2[MAX_AMIGAMONITORS];
+       struct displayscale ds = { 0 };
 
        if (!normalrender)
                return;
 
-       getfilterrect2(d3d->num, &dr, &sr, &zr, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth / d3d->dmult, d3d->m_bitmapHeight / d3d->dmult, d3d->dmult, &d3d->dmode, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+       ds.srcwidth = d3d->m_bitmapWidth / d3d->dmult;
+       ds.srcheight = d3d->m_bitmapHeight / d3d->dmult;
+       ds.scale = d3d->dmult;
+       ds.dstwidth = d3d->m_screenWidth;
+       ds.dstheight = d3d->m_screenHeight;
 
-       if (memcmp(&sr, &sr2[monid], sizeof RECT) || memcmp(&dr, &dr2[monid], sizeof RECT) || memcmp(&zr, &zr2[monid], sizeof RECT)) {
-               write_log(_T("POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d) S=%d*%d B=%d*%d\n"),
-                       dr.left, dr.top, dr.right, dr.bottom,
-                       sr.left, sr.top, sr.right, sr.bottom,
-                       sr.right - sr.left, sr.bottom - sr.top,
-                       zr.left, zr.top,
-                       d3d->m_screenWidth, d3d->m_screenHeight,
-                       d3d->m_bitmapWidth, d3d->m_bitmapHeight);
-               sr2[monid] = sr;
-               dr2[monid] = dr;
-               zr2[monid] = zr;
-       }
-
-       d3d->sr2 = sr;
-       d3d->dr2 = dr;
-       d3d->zr2 = zr;
+       getfilterdata(monid, &ds);
 
-       float dw = (float)dr.right - dr.left;
-       float dh = (float)dr.bottom - dr.top;
-       float w = (float)sr.right - sr.left;
-       float h = (float)sr.bottom - sr.top;
+       float dw = (float)ds.dstwidth;
+       float dh = (float)ds.dstheight;
+       float w = (float)ds.outwidth;
+       float h = (float)ds.outheight;
 
-       int tx = ((dr.right - dr.left) * d3d->m_bitmapWidth) / (d3d->m_screenWidth * 2);
-       int ty = ((dr.bottom - dr.top) * d3d->m_bitmapHeight) / (d3d->m_screenHeight * 2);
+       float tx = (dw * d3d->m_bitmapWidth) / (d3d->m_screenWidth * 2);
+       float ty = (dh * d3d->m_bitmapHeight) / (d3d->m_screenHeight * 2);
 
        float sw = dw / d3d->m_screenWidth;
        float sh = dh / d3d->m_screenHeight;
 
-       int xshift = -zr.left - sr.left;
-       int yshift = -zr.top - sr.top;
+       int xshift = -ds.xoffset;
+       int yshift = -ds.yoffset;
 
-       xshift -= ((sr.right - sr.left) - d3d->m_screenWidth) / 2;
-       yshift -= ((sr.bottom - sr.top) - d3d->m_screenHeight) / 2;
+       xshift -= (w - d3d->m_screenWidth) / 2;
+       yshift -= (h - d3d->m_screenHeight) / 2;
 
-       d3d->xoffset = (float)tx + xshift - d3d->m_screenWidth / 2.0f;
-       d3d->yoffset = (float)ty + yshift - d3d->m_screenHeight / 2.0f;
+       d3d->xoffset = tx + xshift - d3d->m_screenWidth / 2.0f;
+       d3d->yoffset = ty + yshift - d3d->m_screenHeight / 2.0f;
 
        d3d->xmult = filterrectmult(d3d->m_screenWidth, w, d3d->dmode);
        d3d->ymult = filterrectmult(d3d->m_screenHeight, h, d3d->dmode);
@@ -1609,13 +1596,13 @@ static void setupscenecoords(struct d3d11struct *d3d, bool normalrender, int mon
        d3d->xoffset *= d3d->xmult;
        d3d->yoffset *= d3d->ymult;
 
-       d3d->cursor_offset_x = -zr.left;
-       d3d->cursor_offset_y = -zr.top;
+       d3d->cursor_offset_x = -ds.xoffset;
+       d3d->cursor_offset_y = -ds.yoffset;
 
        UpdateBuffers(d3d, monid);
 
        xD3DXMatrixOrthoOffCenterLH(&d3d->m_matProj_out, 0, w + 0.05f, 0, h + 0.05f, 0.0f, 1.0f);
-       xD3DXMatrixTranslation(&d3d->m_matView_out, (float)tx, (float)ty, 1.0f);
+       xD3DXMatrixTranslation(&d3d->m_matView_out, tx, ty, 1.0f);
        sw *= d3d->m_bitmapWidth;
        sh *= d3d->m_bitmapHeight;
        xD3DXMatrixScaling(&d3d->m_matWorld_out, sw + 0.5f / sw, sh + 0.5f / sh, 1.0f);
@@ -2026,10 +2013,6 @@ static bool CreateTexture(struct d3d11struct *d3d)
        D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
        HRESULT hr;
 
-       memset(&d3d->sr2, 0, sizeof(RECT));
-       memset(&d3d->dr2, 0, sizeof(RECT));
-       memset(&d3d->zr2, 0, sizeof(RECT));
-
        FreeTextures(d3d);
 
        memset(&desc, 0, sizeof desc);
index b1166a43718c35c81a30dd391e0e93e962c94ec9..b06d690f3870ddb857092938f1e361e24fce8096 100644 (file)
@@ -61,7 +61,6 @@ struct gdistruct
        float cursor_mx, cursor_my;
        bool cursor_v, cursor_scale;
 
-       RECT sr2, dr2, zr2;
        int dmult, dmultxh, dmultxv, dmode;
        int xoffset, yoffset;
        float xmult, ymult;
@@ -82,44 +81,32 @@ static void gdi_restore(int monid, bool checkonly)
 
 static void setupscenecoords(struct gdistruct *gdi, int monid)
 {
-       RECT sr, dr, zr;
-       static RECT sr2[MAX_AMIGAMONITORS], dr2[MAX_AMIGAMONITORS], zr2[MAX_AMIGAMONITORS];
+       struct displayscale ds = { 0 };
 
-       getfilterrect2(gdi->num, &dr, &sr, &zr, gdi->wwidth, gdi->wheight, gdi->bm.width / gdi->dmult, gdi->bm.height / gdi->dmult, gdi->dmult, &gdi->dmode, gdi->bm.width, gdi->bm.height);
+       ds.srcwidth = gdi->bm.width;
+       ds.srcheight = gdi->bm.height;
+       ds.scale = 1;
+       ds.dstwidth = gdi->wwidth;
+       ds.dstheight = gdi->wheight;
 
-       if (memcmp(&sr, &sr2[monid], sizeof RECT) || memcmp(&dr, &dr2[monid], sizeof RECT) || memcmp(&zr, &zr2[monid], sizeof RECT)) {
-               write_log(_T("POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d) S=%d*%d B=%d*%d\n"),
-                       dr.left, dr.top, dr.right, dr.bottom,
-                       sr.left, sr.top, sr.right, sr.bottom,
-                       sr.right - sr.left, sr.bottom - sr.top,
-                       zr.left, zr.top,
-                       gdi->wwidth, gdi->wheight,
-                       gdi->bm.width, gdi->bm.height);
-               sr2[monid] = sr;
-               dr2[monid] = dr;
-               zr2[monid] = zr;
-       }
-
-       gdi->sr2 = sr;
-       gdi->dr2 = dr;
-       gdi->zr2 = zr;
+       getfilterdata(monid, &ds);
 
-       float dw = (float)dr.right - dr.left;
-       float dh = (float)dr.bottom - dr.top;
-       float w = (float)sr.right - sr.left;
-       float h = (float)sr.bottom - sr.top;
+       float dw = (float)ds.dstwidth;
+       float dh = (float)ds.dstheight;
+       float w = (float)ds.outwidth;
+       float h = (float)ds.outheight;
 
-       int tx = ((dr.right - dr.left) * gdi->bm.width) / (gdi->wwidth * 2);
-       int ty = ((dr.bottom - dr.top) * gdi->bm.height) / (gdi->wheight * 2);
+       int tx = (dw * gdi->bm.width) / (gdi->wwidth * 2);
+       int ty = (dh * gdi->bm.height) / (gdi->wheight * 2);
 
        float sw = dw / gdi->wwidth;
        float sh = dh / gdi->wheight;
 
-       int xshift = -zr.left - sr.left;
-       int yshift = -zr.top - sr.top;
+       int xshift = -ds.xoffset;
+       int yshift = -ds.yoffset;
 
-       xshift -= ((sr.right - sr.left) - gdi->wwidth) / 2;
-       yshift -= ((sr.bottom - sr.top) - gdi->wheight) / 2;
+       xshift -= (w - gdi->wwidth) / 2;
+       yshift -= (h - gdi->wheight) / 2;
 
        gdi->xoffset = tx + xshift - gdi->wwidth / 2;
        gdi->yoffset = ty + yshift - gdi->wheight / 2;
@@ -127,8 +114,8 @@ static void setupscenecoords(struct gdistruct *gdi, int monid)
        gdi->xmult = filterrectmult(gdi->wwidth, w, gdi->dmode);
        gdi->ymult = filterrectmult(gdi->wheight, h, gdi->dmode);
 
-       gdi->cursor_offset_x = -zr.left;
-       gdi->cursor_offset_y = -zr.top;
+       gdi->cursor_offset_x = -ds.xoffset;
+       gdi->cursor_offset_y = -ds.yoffset;
 
        sw *= gdi->wwidth;
        sh *= gdi->wheight;
index 111d3d933d105613f28ff1a4e64943f70d5b205b..7395cc5f6b656c9761ee2d4fa45ac7edf2d5136b 100644 (file)
@@ -118,6 +118,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
        int bits;
        int depth = usealpha() ? 32 : 24;
        bool renderTarget = true;
+       bool locked = false;
 
        lockrtg();
 
@@ -172,7 +173,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
                        rgb_rs2 = rgb_rs;
                        rgb_as2 = rgb_as;
                } else {
-                       src = mem = getfilterbuffer(monid, &width, &height, &spitch, &bits);
+                       src = mem = getfilterbuffer(monid, &width, &height, &spitch, &bits, &locked);
                        needfree = true;
                        rgb_bb2 = rgb_bb;
                        rgb_gb2 = rgb_gb;
@@ -193,7 +194,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
                                if (WIN32GFX_IsPicassoScreen(mon))
                                        gfxboard_freertgbuffer(0, mem);
                                else
-                                       freefilterbuffer(0, mem);
+                                       freefilterbuffer(0, mem, locked);
                        }
                        goto donormal;
                }
@@ -294,7 +295,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
                                if (WIN32GFX_IsPicassoScreen(mon))
                                        gfxboard_freertgbuffer(monid, mem);
                                else
-                                       freefilterbuffer(monid, mem);
+                                       freefilterbuffer(monid, mem, locked);
                        }
                        goto oops;
                }
@@ -413,7 +414,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
                        if (gfxboard_isgfxboardscreen(monid))
                                gfxboard_freertgbuffer(monid, mem);
                        else
-                               freefilterbuffer(monid, mem);
+                               freefilterbuffer(monid, mem, locked);
                }
 
        } else {
index e17ecd41b75fb1f1323e8da21c56bc783782ba01..d27f2651ff2c958593e640a20c42c6569a60caf0 100644 (file)
 #define AUTORESIZE_FRAME_DELAY 10
 
 static float filteroffsetx, filteroffsety, filterxmult = 1.0, filterymult = 1.0;
-static int dst_width, dst_height;
-uae_u8 *bufmem_ptr;
-static int deskw, deskh;
-static bool inited;
 
 void getfilteroffset(int monid, float *dx, float *dy, float *mx, float *my)
 {
@@ -33,39 +29,12 @@ void getfilteroffset(int monid, float *dx, float *dy, float *mx, float *my)
        *my = filterymult;
 }
 
-static void getinit(int monid)
+static void sizeoffset(struct displayscale *ds, int w, int h)
 {
-       if (isfullscreen()) {
-               struct MultiDisplay *md = getdisplay(&currprefs, monid);
-
-               deskw = md->rect.right - md->rect.left;
-               deskh = md->rect.bottom - md->rect.top;
-       } else {
-               deskw = dst_width;
-               deskh = dst_height;
-       }
-}
-
-static uae_u8 *getfilterrect1 (RECT *sr, RECT *dr, int dst_width, int dst_height, int dst_depth, int aw, int ah, int scale, int temp_width, int temp_height, uae_u8 *dptr, int pitch)
-{
-       int aws, ahs;
-
-       aws = aw * scale;
-       ahs = ah * scale;
-
-       SetRect (sr, 0, 0, 0, 0);
-       dr->left = sr->left + (temp_width - aws) /2;
-       dr->top = sr->top + (temp_height - ahs) / 2;
-       dptr += dr->left * (dst_depth / 8);
-       dptr += dr->top * pitch;
-       return dptr;
-}
-
-static void sizeoffset (RECT *dr, RECT *zr, int w, int h)
-{
-       dr->right -= w;
-       dr->bottom -= h;
-       OffsetRect (zr, w / 2, h / 2);
+       ds->outwidth -= w;
+       ds->outheight -= h;
+       ds->xoffset += w / 2;
+       ds->yoffset += h / 2;
 }
 
 static bool getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp)
@@ -200,7 +169,7 @@ static bool get_aspect(int monid, float *dstratiop, float *srcratiop, float *xmu
        return aspect;
 }
 
-void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int *mode, int temp_width, int temp_height)
+void getfilterdata(int monid, struct displayscale *ds)
 {
        struct AmigaMonitor *mon = &AMonitors[monid];
        struct amigadisplay *ad = &adisplays[monid];
@@ -231,22 +200,25 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
        float filter_vert_offset = currprefs.gf[idx].gfx_filter_vert_offset / 10000.0f;
 
        store_custom_limits (-1, -1, -1, -1);
-       *mode = 0;
+       ds->mode = 0;
+       ds->outwidth = ds->srcwidth;
+       ds->outheight = ds->srcheight;
 
        if (mon->screen_is_picasso) {
-               getrtgfilterrect2(monid, sr, dr, zr, mode, dst_width, dst_height);
-               if (D3D_getscalerect && D3D_getscalerect(monid, &mrmx, &mrmy, &mrsx, &mrsy, dst_width, dst_height)) {
-                       sizeoffset(dr, zr, (int)mrmx, (int)mrmy);
-                       OffsetRect(dr, (int)mrsx, (int)mrsy);
+               getrtgfilterdata(monid, ds);
+               if (D3D_getscalerect && D3D_getscalerect(monid, &mrmx, &mrmy, &mrsx, &mrsy, ds->dstwidth, ds->dstheight)) {
+                       ds->xoffset += (int)mrsx;
+                       ds->yoffset += (int)mrsy;
+                       ds->dstwidth += (int)mrmx;
+                       ds->dstheight += (int)mrmy;
                }
                return;
        }
 
        fpux_save (&fpuv);
 
-       getinit(monid);
-       aws = aw * scale;
-       ahs = ah * scale;
+       aws = ds->srcwidth * ds->scale;
+       ahs = ds->srcheight * ds->scale;
        //write_log (_T("%d %d %d\n"), dst_width, temp_width, aws);
        extraw = (int)(-aws * (filter_horiz_zoom - currprefs.gf[idx].gfx_filteroverlay_overscan * 10) / 2.0f);
        extrah = (int)(-ahs * (filter_vert_zoom - currprefs.gf[idx].gfx_filteroverlay_overscan * 10) / 2.0f);
@@ -257,17 +229,6 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                //extrah -= mrmy;
        }
 
-       SetRect (sr, 0, 0, dst_width, dst_height);
-       SetRect (zr, 0, 0, 0, 0);
-       dr->left = (temp_width - aws) / 2;
-       dr->top = (temp_height - ahs) / 2;
-
-       dr->left -= (dst_width - aws) / 2;
-       dr->top -= (dst_height - ahs) / 2;
-
-       dr->right = dr->left + dst_width;
-       dr->bottom = dr->top + dst_height;
-
        filteroffsetx = 0;
        filteroffsety = 0;
        float xmult = filter_horiz_zoom_mult;
@@ -285,21 +246,21 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                filter_aspect = 0;
                keep_aspect = 0;
                palntscadjust = 1;
-               if (dst_width >= 640 && dst_width <= 800 && dst_height >= 480 && dst_height <= 600 && !programmedmode) {
+               if (ds->dstwidth >= 640 && ds->dstwidth <= 800 && ds->dstheight >= 480 && ds->dstheight <= 600 && !programmedmode) {
                        autoselect = 1;
                        scalemode = AUTOSCALE_NONE;
                        int m = 1;
                        int w = AMIGA_WIDTH_MAX << currprefs.gfx_resolution;
                        int h = AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution;
                        for (;;) {
-                               if (w * (m * 2) > dst_width || h * (m * 2) > dst_height) {
+                               if (w * (m * 2) > ds->dstwidth || h * (m * 2) > ds->dstheight) {
                                        break;
                                }
                                m *= 2;
                        }
                        autoselect = m;
                } else {
-                       float dstratio = 1.0f * dst_width / dst_height;
+                       float dstratio = 1.0f * ds->dstwidth / ds->dstheight;
                        scalemode = AUTOSCALE_STATIC_NOMINAL;
                        if (dstratio > srcratio + 0.1 || dstratio < srcratio - 0.1) {
                                filter_aspect = -1;
@@ -310,10 +271,7 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
        if (filter_aspect > 0) {
                dstratio = (filter_aspect / ASPECTMULT) * 1.0f / (filter_aspect & (ASPECTMULT - 1));
        } else if (filter_aspect < 0) {
-               if (isfullscreen() && deskw > 0 && deskh > 0)
-                       dstratio = 1.0f * deskw / deskh;
-               else
-                       dstratio = 1.0f * dst_width / dst_height;
+               dstratio = 1.0f * ds->dstwidth / ds->dstheight;
        } else {
                dstratio = srcratio;
        }
@@ -327,8 +285,8 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                int cw, ch, cx, cy, cv = 0, crealh = 0;
                static int oxmult, oymult;
 
-               filterxmult = (float)scale;
-               filterymult = (float)scale;
+               filterxmult = (float)ds->scale;
+               filterymult = (float)ds->scale;
 
                if (scalemode == AUTOSCALE_STATIC_MAX || scalemode == AUTOSCALE_STATIC_NOMINAL ||
                        scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
@@ -366,8 +324,8 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                        }
 
                        if (scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
-                               int maxw = isfullscreen() < 0 ? deskw : gmc->gfx_size.width;
-                               int maxh = isfullscreen() < 0 ? deskh : gmc->gfx_size.height;
+                               int maxw = isfullscreen() < 0 ? ds->dstwidth : gmc->gfx_size.width;
+                               int maxh = isfullscreen() < 0 ? ds->dstheight : gmc->gfx_size.height;
                                float mult = 1.0f;
                                bool ok = true;
                                bool manual = false;
@@ -437,8 +395,8 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                                        mult += multadd;
                                                }
                                                float multx = mult, multy = mult;
-                                               maxw = (int)(maxw * multx);
-                                               maxh = (int)(maxh * multy);
+                                               maxw = maxw * mult;
+                                               maxh = maxh * mult;
                                        } else {
                                                while (((cw2 * (mult + multadd)) / m) - adjw <= maxw && ch2 * (mult + multadd) - adjh <= maxh) {
                                                        mult += multadd;
@@ -453,12 +411,13 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                                if (ch2 * (mult * 2) - adjh <= maxh && cw2 > ch2 * 2.4) {
                                                        multy *= 2;
                                                }
-                                               maxw = (int)((maxw + multx - multadd) / multx);
-                                               maxh = (int)((maxh + multy - multadd) / multy);
+                                               maxw = (maxw + mult - multadd) / mult;
+                                               maxh = (maxh + mult - multadd) / mult;
                                        }
                                }
 
-                               *mode = 1;
+                               ds->mode = 1;
+                               cv = 2;
 
                                dstratio = 1.0f * cw / ch;
 
@@ -532,18 +491,14 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
 
                        if (scalemode == AUTOSCALE_CENTER) {
 
-                               int ww = cw * scale;
-                               int hh = ch * scale;
+                               int ww = cw * ds->scale;
+                               int hh = ch * ds->scale;
 
-                               SetRect (sr, 0, 0, dst_width, dst_height);
-                               SetRect (zr, 0, 0, 0, 0);
+                               ds->outwidth = ds->dstwidth * ds->scale;
+                               ds->outheight = ds->dstheight * ds->scale;
+                               ds->xoffset += cx * ds->scale - (ds->dstwidth - ww) / 2;
+                               ds->yoffset += cy * ds->scale - (ds->dstheight - hh) / 2;
 
-                               dr->left = (temp_width - aws) /2;
-                               dr->top =  (temp_height - ahs) / 2;
-                               dr->right = dr->left + dst_width * scale;
-                               dr->bottom = dr->top + dst_height * scale;
-
-                               OffsetRect (zr, cx * scale - (dst_width - ww) / 2, cy * scale - (dst_height - hh) / 2);
                                goto cont;
 
                        } else if (scalemode == AUTOSCALE_RESIZE && isfullscreen() == 0 && !currprefs.gf[idx].gfx_filteroverlay[0]) {
@@ -589,14 +544,14 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                }
                                float scalex = currprefs.gf[idx].gfx_filter_horiz_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_horiz_zoom_mult : 1.0f;
                                float scaley = currprefs.gf[idx].gfx_filter_vert_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_vert_zoom_mult : 1.0f;
-                               SetRect (sr, 0, 0, (int)(cw * scale * scalex), (int)(ch * scale * scaley));
-                               dr->left = (temp_width - aws) /2;
-                               dr->top = (temp_height - ahs) / 2;
-                               dr->right = dr->left + cw * scale;
-                               dr->bottom = dr->top + ch * scale;
-                               OffsetRect (zr, cx * scale, cy * scale);
-                               int ww = (int)((dr->right - dr->left) * scalex);
-                               int hh = (int)((dr->bottom - dr->top) * scaley);
+
+                               ds->outwidth = (int)(cw * ds->scale * scalex);
+                               ds->outheight = (int)(ch * ds->scale * scaley);
+                               ds->xoffset += cx * ds->scale;
+                               ds->yoffset += cy * ds->scale;
+
+                               int ww = (int)(ds->outwidth * scalex);
+                               int hh = (int)(ds->outheight * scaley);
                                if (currprefs.gfx_xcenter_size >= 0)
                                        ww = currprefs.gfx_xcenter_size;
                                if (currprefs.gfx_ycenter_size >= 0)
@@ -610,26 +565,23 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                        if (oldwinw != gmh->gfx_size_win.width || oldwinh != gmh->gfx_size_win.height)
                                                set_config_changed ();
                                }
-                               OffsetRect (zr, -(gmh->gfx_size_win.width - ww + 1) / 2, -(gmh->gfx_size_win.height - hh + 1) / 2);
-                               filteroffsetx = (float)-zr->left / scale;
-                               filteroffsety = (float)-zr->top / scale;
+                               ds->xoffset += -(gmh->gfx_size_win.width - ww + 1) / 2;
+                               ds->yoffset += -(gmh->gfx_size_win.height - hh + 1) / 2;
+
+                               filteroffsetx = (float)-ds->xoffset / ds->scale;
+                               filteroffsety = (float)-ds->yoffset / ds->scale;
                                goto end;
                        }
 
-                       dr->left = (temp_width - aws) /2;
-                       dr->top =  (temp_height - ahs) / 2;
-                       dr->right = dr->left + dst_width * scale;
-                       dr->bottom = dr->top + dst_height * scale;
-
-                       OffsetRect (zr, cx * scale, cy * scale);
+                       ds->outwidth = cw * ds->scale;
+                       ds->outheight = ch * ds->scale;
+                       ds->xoffset = cx * ds->scale;
+                       ds->yoffset = cy * ds->scale;
 
-                       sizeoffset (dr, zr, extraw, extrah);
+                       sizeoffset(ds, extraw, extrah);
 
-                       dr->right -= (dst_width - cw) * scale;
-                       dr->bottom -= (dst_height - ch) * scale;
-
-                       filteroffsetx = (float)-zr->left / scale;
-                       filteroffsety = (float)-zr->top / scale;
+                       filteroffsetx = (float)-ds->xoffset / ds->scale;
+                       filteroffsety = (float)-ds->yoffset / ds->scale;
 
                        bool aspect = false;
 
@@ -638,31 +590,31 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                        if (width_aspect > 0) {
                                diffx = width_aspect;
                        } else {
-                               diffx = dr->right - dr->left;
+                               diffx = ds->outwidth;
                        }
                        if (height_aspect > 0) {
                                diffy = height_aspect;
                        } else {
-                               diffy = dr->bottom - dr->top;
+                               diffy = ds->outheight;
                        }
 
                        if (get_aspect(monid, &dstratio, &srcratio, &xmult, &ymult, doautoaspect, autoaspectratio, keep_aspect, filter_aspect)) {
                                diff = diffx - (int)(diffx * xmult);
-                               sizeoffset(dr, zr, diff, 0);
+                               sizeoffset(ds, diff, 0);
                                filteroffsetx += -diff / 2;
 
                                diff = diffy - (int)(diffy * ymult);
-                               sizeoffset(dr, zr, 0, diff);
+                               sizeoffset(ds, 0, diff);
                                filteroffsety += -diff / 2;
                        }
 
-                       OffsetRect (zr, (int)(-filter_horiz_offset * aws), 0);
-                       OffsetRect (zr, 0, (int)(-filter_vert_offset * ahs));
+                       ds->xoffset += (int)(-filter_horiz_offset * aws);
+                       ds->yoffset += (int)(-filter_vert_offset * ahs);
 
-                       diff = dr->right - dr->left;
-                       filterxmult = ((float)dst_width * scale) / diff;
-                       diff = dr->bottom - dr->top;
-                       filterymult = ((float)dst_height * scale) / diff;
+                       diff = ds->dstwidth;
+                       filterxmult = ((float)ds->dstwidth * ds->scale) / diff;
+                       diff = ds->dstheight;
+                       filterymult = ((float)ds->dstheight * ds->scale) / diff;
 
                        goto end;
                }
@@ -672,20 +624,20 @@ cont:
 
        if (!filter_horiz_zoom_mult && !filter_vert_zoom_mult) {
 
-               sizeoffset (dr, zr, extraw, extrah);
+               sizeoffset(ds, extraw, extrah);
 
                if (keep_aspect) {
                        float xm, ym, m;
 
-                       xm = (float)aws / dst_width;
-                       ym = (float)ahs / dst_height;
+                       xm = (float)aws / ds->dstwidth;
+                       ym = (float)ahs / ds->dstheight;
                        if (xm < ym)
                                xm = ym;
                        else
                                ym = xm;
                        xmult = ymult = xm;
 
-                       m = (float)(aws * dst_width) / (ahs * dst_height);
+                       m = (float)(aws * ds->dstwidth) / (ahs * ds->dstheight);
                        dstratio = dstratio * m;
                }
 
@@ -751,11 +703,11 @@ cont:
        }
 
        if (xmult <= 0.01)
-               xmult = (float)dst_width / aws;
+               xmult = (float)ds->dstwidth / aws;
        else
                xmult = xmult + xmult * filter_horiz_zoom / 2.0f;
        if (ymult <= 0.01)
-               ymult = (float)dst_height / ahs;
+               ymult = (float)ds->dstheight / ahs;
        else
                ymult = ymult + ymult * filter_vert_zoom / 2.0f;
 
@@ -765,27 +717,31 @@ cont:
                }
        }
 
-       OffsetRect (zr, (int)(-filter_horiz_offset * aws), 0);
-       OffsetRect (zr, 0, (int)(-filter_vert_offset * ahs));
+       ds->xoffset += (int)(-filter_horiz_offset * aws);
+       ds->yoffset += (int)(-filter_vert_offset * ahs);
 
-       xs = dst_width;
-       if (xmult)
-               xs -= (int)(dst_width / xmult);
-       ys = dst_height;
-       if (ymult)
-               ys -= (int)(dst_height / ymult);
-       sizeoffset (dr, zr, xs, ys);
+       xs = ds->dstwidth;
+       if (xmult) {
+               xs -= (int)(ds->dstwidth / xmult);
+       }
+       ys = ds->dstheight;
+       if (ymult) {
+               ys -= (int)(ds->dstheight / ymult);
+       }
+       sizeoffset(ds, xs, ys);
 
        filterxmult = xmult;
        filterymult = ymult;
-       filteroffsetx += (dst_width - aw * filterxmult) / 2;
-       filteroffsety += (dst_height - ah * filterymult) / 2;
+       filteroffsetx += (ds->dstwidth - ds->srcwidth * filterxmult) / 2;
+       filteroffsety += (ds->dstheight - ds->srcheight * filterymult) / 2;
 
 end:
 
        if (D3D_getscalerect && D3D_getscalerect(monid, &mrmx, &mrmy, &mrsx, &mrsy, avidinfo->outbuffer->inwidth2, avidinfo->outbuffer->inheight2)) {
-               sizeoffset(dr, zr, (int)mrmx, (int)mrmy);
-               OffsetRect(dr, (int)mrsx, (int)mrsy);
+               ds->xoffset += (int)mrsx;
+               ds->yoffset += (int)mrsy;
+               ds->outwidth += (int)mrmx;
+               ds->outheight += (int)mrmy;
        }
 
        check_custom_limits();
@@ -804,7 +760,7 @@ end:
 
 }
 
-void freefilterbuffer(int monid, uae_u8 *buf)
+void freefilterbuffer(int monid, uae_u8 *buf, bool unlock)
 {
        struct AmigaMonitor *mon = &AMonitors[monid];
        struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
@@ -812,10 +768,12 @@ void freefilterbuffer(int monid, uae_u8 *buf)
 
        if (!vb)
                return;
-       unlockscr3d(vb);
+       if (unlock) {
+               unlockscr(vb, -1, -1);
+       }
 }
 
-uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth)
+uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, bool *locked)
 {
        struct AmigaMonitor *mon = &AMonitors[monid];
        struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
@@ -825,14 +783,18 @@ uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *d
        *widthp = 0;
        *heightp = 0;
        *depth = 32;
+       *locked = false;
        if (!vb)
                return NULL;
-       if (!lockscr3d(vb)) {
-               return NULL;
+       if (!vb->locked) {
+               if (!lockscr(vb, false, false)) {
+                       return NULL;
+               }
+               *locked = true;
        }
        w = vb->outwidth;
        h = vb->outheight;
-       if (!monid) {
+       if (!monid && currprefs.gfx_overscanmode <= OVERSCANMODE_BROADCAST) {
                // if native screen: do not include vertical blank
                h = get_vertical_visible_height(false);
        }
index a3bf11e6a7a535e4191afc4d6ea7f3b046c67b3a..9bdbcc9d9a4d729300cef1a3eca00fd84328a524 100644 (file)
@@ -1444,25 +1444,6 @@ void show_screen(int monid, int mode)
        mon->render_ok = false;
 }
 
-bool lockscr3d(struct vidbuffer *vb)
-{
-       struct AmigaMonitor *mon = &AMonitors[vb->monitor_id];
-       if (mon->currentmode.flags & DM_D3D) {
-               vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, NULL, false);
-               if (vb->bufmem) 
-                       return true;
-       }
-       return false;
-}
-
-void unlockscr3d(struct vidbuffer *vb)
-{
-       struct AmigaMonitor *mon = &AMonitors[vb->monitor_id];
-       if (mon->currentmode.flags & DM_D3D) {
-               D3D_unlocktexture(vb->monitor_id, -1, -1);
-       }
-}
-
 int lockscr(struct vidbuffer *vb, bool fullupdate, bool skip)
 {
        struct AmigaMonitor *mon = &AMonitors[vb->monitor_id];
@@ -1531,22 +1512,18 @@ float filterrectmult(int v1, float v2, int dmode)
        return (float)(int)(v + 0.5f);
 }
 
-void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int dst_width, int dst_height)
+void getrtgfilterdata(int monid, struct displayscale *ds)
 {
        struct AmigaMonitor *mon = &AMonitors[monid];
        struct amigadisplay *ad = &adisplays[monid];
        struct picasso96_state_struct *state = &picasso96_state[monid];
 
-       SetRect (sr, 0, 0, mon->currentmode.native_width, mon->currentmode.native_height);
-       SetRect (dr, 0, 0, state->Width, state->Height);
-       SetRect (zr, 0, 0, 0, 0);
-       
        picasso_offset_x = 0;
        picasso_offset_y = 0;
        picasso_offset_mx = 1.0;
        picasso_offset_my = 1.0;
 
-       *mode = 0;
+       ds->mode = 0;
 
        if (!ad->picasso_on)
                return;
@@ -1570,8 +1547,6 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int d
 
        float mx = (float)mon->currentmode.native_width / srcwidth;
        float my = (float)mon->currentmode.native_height / srcheight;
-       int outwidth;
-       int outheight;
 
        if (mon->scalepicasso == RTG_MODE_INTEGER_SCALE) {
                int divx = mon->currentmode.native_width / srcwidth;
@@ -1585,25 +1560,22 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int d
                                mul = 0.25f;
                        }
                }
-               SetRect(dr, 0, 0, (int)(mon->currentmode.native_width / mul), (int)(mon->currentmode.native_height / mul));
+               ds->outwidth = (int)(mon->currentmode.native_width / mul);
+               ds->outheight = (int)(mon->currentmode.native_height / mul);
                int xx = (int)((mon->currentmode.native_width / mul - srcwidth) / 2);
                int yy = (int)((mon->currentmode.native_height / mul - srcheight) / 2);
                picasso_offset_x = -xx;
                picasso_offset_y = -yy;
                mx = mul;
                my = mul;
-               outwidth = srcwidth;
-               outheight = srcheight;
-               *mode = 1;
+               ds->mode = 1;
        } else if (mon->scalepicasso == RTG_MODE_CENTER) {
                int xx = (mon->currentmode.native_width - srcwidth) / 2;
                int yy = (mon->currentmode.native_height - srcheight) / 2;
                picasso_offset_x = -xx;
                picasso_offset_y = -yy;
-               SetRect (sr, 0, 0, mon->currentmode.native_width, mon->currentmode.native_height);
-               SetRect (dr, 0, 0, mon->currentmode.native_width, mon->currentmode.native_height);
-               outwidth = dr->right - dr->left;
-               outheight = dr->bottom - dr->top;
+               ds->outwidth = mon->currentmode.native_width;
+               ds->outheight = mon->currentmode.native_height;
                mx = my = 1.0;
        } else {
                if (currprefs.win32_rtgscaleaspectratio < 0) {
@@ -1620,27 +1592,29 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int d
                }
 
                if (srcratio == dstratio) {
-                       SetRect (dr, 0, 0, srcwidth, srcheight);
+                       ds->outwidth = srcwidth;
+                       ds->outheight = srcheight;
                } else if (srcratio > dstratio) {
                        int yy = srcheight * srcratio / dstratio;
-                       SetRect (dr, 0, 0, srcwidth, yy);
+                       ds->outwidth = srcwidth;
+                       ds->outheight = yy;
                        picasso_offset_y = (state->Height - yy) / 2;
                } else {
                        int xx = srcwidth * dstratio / srcratio;
-                       SetRect (dr, 0, 0, xx, srcheight);
+                       ds->outwidth = xx;
+                       ds->outheight = srcheight;
                        picasso_offset_x = (state->Width - xx) / 2;
                }
-               outwidth = dr->right - dr->left;
-               outheight = dr->bottom - dr->top;
        }
 
-       OffsetRect (zr, picasso_offset_x, picasso_offset_y);
+       ds->xoffset += picasso_offset_x;
+       ds->yoffset += picasso_offset_y;
 
        picasso_offset_x /= state->HLineDBL;
        picasso_offset_y /= state->VLineDBL;
 
-       picasso_offset_mx = (float)(srcwidth * mx * state->HLineDBL) / outwidth;
-       picasso_offset_my = (float)(srcheight * my * state->VLineDBL) / outheight;
+       picasso_offset_mx = (float)(srcwidth * mx * state->HLineDBL) / ds->dstwidth;
+       picasso_offset_my = (float)(srcheight * my * state->VLineDBL) / ds->dstheight;
 }
 
 static uae_u8 *gfx_lock_picasso2(int monid, bool fullupdate)
index 5ce9a42625300924e1f8fa2225e9249f83564f71..040fa1b4a039abe89d221a977bcd5a78dc883127 100644 (file)
@@ -34,12 +34,8 @@ extern void updatewinfsmode(int monid, struct uae_prefs *p);
 extern void gfx_lock(void);
 extern void gfx_unlock(void);
 
-extern bool lockscr3d(struct vidbuffer *vb);
-extern void unlockscr3d(struct vidbuffer *vb);
-
 void centerdstrect(struct AmigaMonitor*, RECT *);
 struct MultiDisplay *getdisplay(struct uae_prefs *p, int monid);
 extern int getrefreshrate(int monid, int width, int height);
 
-bool osd_keyboard(int show);
 #endif