From 497891a30c459d54b6fcb7bcc5460f8021f66cc6 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 27 Jan 2019 17:15:24 +0200 Subject: [PATCH] Autoscale border blanking updates. --- drawing.cpp | 20 ++++++++++++----- od-win32/rp.cpp | 46 +++++++++++++++++++++++++++++---------- od-win32/win32_scaler.cpp | 16 +++++++++----- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index b6e26c01..77e919de 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -504,16 +504,16 @@ void get_custom_raw_limits (int *pw, int *ph, int *pdx, int *pdy) void check_custom_limits(void) { + struct gfx_filterdata *fd = &currprefs.gf[0]; int vls = visible_left_start; int vrs = visible_right_stop; int vts = visible_top_start; int vbs = visible_bottom_stop; - struct gfx_filterdata *fd = &currprefs.gf[0]; - int left = fd->gfx_filter_left_border >> (RES_MAX - currprefs.gfx_resolution); - int right = fd->gfx_filter_right_border >> (RES_MAX - currprefs.gfx_resolution); - int top = fd->gfx_filter_top_border; - int bottom = fd->gfx_filter_bottom_border; + int left = fd->gfx_filter_left_border < 0 ? 0 : fd->gfx_filter_left_border >> (RES_MAX - currprefs.gfx_resolution); + int right = fd->gfx_filter_right_border < 0 ? 0 : fd->gfx_filter_right_border >> (RES_MAX - currprefs.gfx_resolution); + int top = fd->gfx_filter_top_border < 0 ? 0 : fd->gfx_filter_top_border; + int bottom = fd->gfx_filter_bottom_border < 0 ? 0 : fd->gfx_filter_bottom_border; if (left > visible_left_start) visible_left_start = left; @@ -530,11 +530,21 @@ void check_custom_limits(void) void set_custom_limits (int w, int h, int dx, int dy) { + struct gfx_filterdata *fd = &currprefs.gf[0]; int vls = visible_left_start; int vrs = visible_right_stop; int vts = visible_top_start; int vbs = visible_bottom_stop; + if (fd->gfx_filter_left_border == 0) { + w = 0; + dx = 0; + } + if (fd->gfx_filter_top_border == 0) { + h = 0; + dy = 0; + } + if (specialmonitor_uses_control_lines()) { w = -1; h = -1; diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index b48ba688..393c0666 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -899,6 +899,8 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) else fs = 1; } + p->gf[0].gfx_filter_left_border = 0; + p->gf[0].gfx_filter_top_border = 0; p->gf[0].gfx_filter_autoscale = AUTOSCALE_CENTER; disp = getdisplay(p, 0); @@ -1055,19 +1057,21 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) hmult = vmult = 0; } else if (integerscale) { hmult = vmult = 1; - p->gf[0].gfx_filter_autoscale = AUTOSCALE_INTEGER; p->gf[0].gfx_filter_integerscalelimit = 0; if (sm->dwClipFlags & RP_CLIPFLAGS_AUTOCLIP) { + p->gf[0].gfx_filter_autoscale = AUTOSCALE_INTEGER_AUTOSCALE; p->gfx_xcenter_pos = -1; p->gfx_ycenter_pos = -1; p->gfx_xcenter_size = -1; p->gfx_ycenter_size = -1; } else { + p->gf[0].gfx_filter_autoscale = AUTOSCALE_INTEGER; if (sm->lClipWidth > 0) p->gfx_xcenter_size = sm->lClipWidth; if (sm->lClipHeight > 0) p->gfx_ycenter_size = sm->lClipHeight; } + } if (keepaspect) { @@ -1122,6 +1126,11 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) p->gf[0].gfx_filter_scanlinelevel = 8; p->gf[0].gfx_filter_scanlineratio = (1 << 4) | 1; } + + if (sm->dwClipFlags & RP_CLIPFLAGS_AUTOCLIP) { + p->gf[0].gfx_filter_left_border = -1; + p->gf[0].gfx_filter_top_border = -1; + } } if (log_rp & 2) { @@ -1374,7 +1383,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM h -= 1 << (currprefs.gfx_vresolution - 1); } allocvidbuffer (0, &vb, w, h, avidinfo->drawbuffer.pixbytes * 8); - set_custom_limits (-1, -1, -1, -1); + set_custom_limits(0, 0, 0, 0); draw_frame (&vb); ok |= screenshotf(0, rpsc->szScreenRaw, 1, 1, 1, &vb); if (log_rp & 2) @@ -1779,16 +1788,18 @@ static void rp_device_writeprotect (int dev, int num, bool writeprotected) return; if (rp_version * 256 + rp_revision < 2 * 256 + 3) return; + if (log_rp & 1) + write_log(_T("RP_IPC_TO_HOST_DEVICEREADWRITE %d %d %d\n"), dev, num, writeprotected); RPSendMessagex (RP_IPC_TO_HOST_DEVICEREADWRITE, MAKEWORD(dev, num), writeprotected ? RP_DEVICE_READONLY : RP_DEVICE_READWRITE, NULL, 0, &guestinfo, NULL); } -static void rp_device_change (int dev, int num, int mode, bool readonly, const TCHAR *content) +static void rp_device_change (int dev, int num, int mode, bool readonly, const TCHAR *content, bool preventrecursive) { struct RPDeviceContent dc = { 0 }; if (!cando ()) return; - if (recursive_device) + if (preventrecursive && recursive_device) return; dc.btDeviceCategory = dev; dc.btDeviceNumber = num; @@ -1797,8 +1808,8 @@ static void rp_device_change (int dev, int num, int mode, bool readonly, const T if (content) _tcscpy (dc.szContent, content); if (log_rp & 1) - write_log (_T("RP_IPC_TO_HOST_DEVICECONTENT cat=%d num=%d type=%d '%s'\n"), - dc.btDeviceCategory, dc.btDeviceNumber, dc.dwInputDevice, dc.szContent); + write_log (_T("RP_IPC_TO_HOST_DEVICECONTENT cat=%d num=%d type=%d flags=%x '%s'\n"), + dc.btDeviceCategory, dc.btDeviceNumber, dc.dwInputDevice, dc.dwFlags, dc.szContent); RPSendMessagex (RP_IPC_TO_HOST_DEVICECONTENT, 0, 0, &dc, sizeof(struct RPDeviceContent), &guestinfo, NULL); } @@ -1833,9 +1844,9 @@ void rp_input_change (int num) if (log_rp & 1) write_log(_T("PORT%d: '%s':%d\n"), num, name, mode); if (num >= 2) { - rp_device_change (RP_DEVICECATEGORY_MULTITAPPORT, num - 2, mode, true, name); + rp_device_change (RP_DEVICECATEGORY_MULTITAPPORT, num - 2, mode, true, name, true); } else { - rp_device_change (RP_DEVICECATEGORY_INPUTPORT, num, mode, true, name); + rp_device_change (RP_DEVICECATEGORY_INPUTPORT, num, mode, true, name, true); } } void rp_disk_image_change (int num, const TCHAR *name, bool writeprotected) @@ -1847,7 +1858,7 @@ void rp_disk_image_change (int num, const TCHAR *name, bool writeprotected) cfgfile_resolve_path_out_load(name, tmp, MAX_DPATH, PATH_FLOPPY); p = tmp; } - rp_device_change (RP_DEVICECATEGORY_FLOPPY, num, 0, writeprotected == false, p); + rp_device_change (RP_DEVICECATEGORY_FLOPPY, num, 0, writeprotected, p, false); rp_device_writeprotect (RP_DEVICECATEGORY_FLOPPY, num, writeprotected); } void rp_harddrive_image_change (int num, bool readonly, const TCHAR *name) @@ -1859,7 +1870,7 @@ void rp_harddrive_image_change (int num, bool readonly, const TCHAR *name) cfgfile_resolve_path_out_load(name, tmp, MAX_DPATH, PATH_HDF); p = tmp; } - rp_device_change (RP_DEVICECATEGORY_HD, num, 0, readonly, p); + rp_device_change (RP_DEVICECATEGORY_HD, num, 0, readonly, p, false); } void rp_cd_image_change (int num, const TCHAR *name) { @@ -1870,7 +1881,7 @@ void rp_cd_image_change (int num, const TCHAR *name) cfgfile_resolve_path_out_load(name, tmp, MAX_DPATH, PATH_CD); p = tmp; } - rp_device_change (RP_DEVICECATEGORY_CD, num, 0, true, p); + rp_device_change (RP_DEVICECATEGORY_CD, num, 0, true, p, false); } void rp_floppy_device_enable (int num, bool enabled) @@ -2130,12 +2141,25 @@ void rp_rtg_switch (void) static uae_u64 esctime; static int releasetime, releasenum; +static int rp_prev_w, rp_prev_h, rp_prev_x, rp_prev_y; void rp_vsync(void) { struct AmigaMonitor *mon = &AMonitors[0]; if (!initialized) return; + if (!hwndset_delay && !delayed_refresh && !screenmode_request && isfullscreen()) { + int w, h, x, y; + get_custom_raw_limits(&w, &h, &x, &y); + if (x != rp_prev_x || y != rp_prev_y || + w != rp_prev_w || h != rp_prev_h) { + screenmode_request = 6; + rp_prev_x = x; + rp_prev_y = y; + rp_prev_w = w; + rp_prev_h = h; + } + } if (delayed_refresh) { if (gett() >= delayed_refresh + 50) { if (pause_emulation && D3D_refresh) { diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 79cfb510..f3ccc2f0 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -379,11 +379,14 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int if (scalemode == AUTOSCALE_INTEGER_AUTOSCALE) { ok = get_custom_limits (&cw, &ch, &cx, &cy, &crealh) != 0; - if (ok) - store_custom_limits (cw, ch, cx, cy); + if (ok) { + set_custom_limits(cw, ch, cx, cy); + store_custom_limits(cw, ch, cx, cy); + } } if (scalemode == AUTOSCALE_INTEGER || ok == false) { getmanualpos(monid, &cx, &cy, &cw, &ch); + set_custom_limits(cw, ch, cx, cy); store_custom_limits(cw, ch, cx, cy); } @@ -454,8 +457,11 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int } else if (scalemode == AUTOSCALE_CENTER || scalemode == AUTOSCALE_RESIZE) { cv = get_custom_limits (&cw, &ch, &cx, &cy, &crealh); - if (cv) - store_custom_limits (cw, ch, cx, cy); + if (cv) { + set_custom_limits(cw, ch, cx, cy); + store_custom_limits(cw, ch, cx, cy); + scl = true; + } } else { @@ -469,7 +475,7 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int } if (!scl) { - set_custom_limits (-1, -1, -1, -1); + set_custom_limits (0, 0, 0, 0); } if (!autoaspect_done) { -- 2.47.3