]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Configurable overscan blanking.
authorToni Wilen <twilen@winuae.net>
Sun, 5 Apr 2015 13:13:33 +0000 (16:13 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 5 Apr 2015 13:13:33 +0000 (16:13 +0300)
custom.cpp
drawing.cpp
include/options.h
od-win32/win32_scaler.cpp

index 752b3a5839b66d6a3aac53f60b647e8985972c44..b3cfa4dd69133f8f91f95ad9b1f066129a94cfa4 100644 (file)
@@ -9557,11 +9557,19 @@ void check_prefs_changed_custom (void)
                        init_custom ();
        }
 #ifdef GFXFILTER
-       currprefs.gf[0].gfx_filter_horiz_zoom = changed_prefs.gf[0].gfx_filter_horiz_zoom;
-       currprefs.gf[0].gfx_filter_vert_zoom = changed_prefs.gf[0].gfx_filter_vert_zoom;
-       currprefs.gf[0].gfx_filter_horiz_offset = changed_prefs.gf[0].gfx_filter_horiz_offset;
-       currprefs.gf[0].gfx_filter_vert_offset = changed_prefs.gf[0].gfx_filter_vert_offset;
-       currprefs.gf[0].gfx_filter_scanlines = changed_prefs.gf[0].gfx_filter_scanlines;
+       struct gfx_filterdata *fd = &currprefs.gf[0];
+       struct gfx_filterdata *fdcp = &changed_prefs.gf[0];
+
+       fd->gfx_filter_horiz_zoom = fdcp->gfx_filter_horiz_zoom;
+       fd->gfx_filter_vert_zoom = fdcp->gfx_filter_vert_zoom;
+       fd->gfx_filter_horiz_offset = fdcp->gfx_filter_horiz_offset;
+       fd->gfx_filter_vert_offset = fdcp->gfx_filter_vert_offset;
+       fd->gfx_filter_scanlines = fdcp->gfx_filter_scanlines;
+
+       fd->gfx_filter_left_border = fdcp->gfx_filter_left_border;
+       fd->gfx_filter_right_border = fdcp->gfx_filter_right_border;
+       fd->gfx_filter_top_border = fdcp->gfx_filter_top_border;
+       fd->gfx_filter_bottom_border = fdcp->gfx_filter_bottom_border;
 #endif
 }
 
@@ -9859,7 +9867,16 @@ int is_cycle_ce (void)
 
 #endif
 
-bool ispal (void)
+bool isvga(void)
+{
+       if (!(beamcon0 & 0x80))
+               return false;
+       if (hblank_hz >= 20000)
+               return true;
+       return false;
+}
+
+bool ispal(void)
 {
        if (beamcon0 & 0x80)
                return currprefs.ntscmode == 0;
index 03f8dbff8076afee8c5739a80261b086224be815..50deb2d95b0f1c79ad50043270fbcb43b060f2a9 100644 (file)
@@ -443,6 +443,32 @@ void get_custom_raw_limits (int *pw, int *ph, int *pdx, int *pdy)
        }
 }
 
+void check_custom_limits(void)
+{
+       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;
+
+       if (left > visible_left_start)
+               visible_left_start = left;
+       if (right > left && right < visible_right_stop)
+               visible_right_stop = right;
+
+       if (top > visible_top_start)
+               visible_top_start = top;
+       if (bottom > top && bottom < visible_bottom_stop)
+               visible_bottom_stop = bottom;
+       
+       set_blanking_limits ();
+}
+
 void set_custom_limits (int w, int h, int dx, int dy)
 {
        int vls = visible_left_start;
@@ -464,10 +490,12 @@ void set_custom_limits (int w, int h, int dx, int dy)
                visible_top_start = min_ypos_for_screen + dy;
                visible_bottom_stop = visible_top_start + h;
        }
+
        if (vls != visible_left_start || vrs != visible_right_stop ||
                vts != visible_top_start || vbs != visible_bottom_stop)
                notice_screen_contents_lost ();
-       set_blanking_limits ();
+
+       check_custom_limits();
 }
 
 void store_custom_limits (int w, int h, int x, int y)
@@ -1062,11 +1090,19 @@ static void fill_line2 (int startpos, int len)
        }
 }
 
-static void fill_line_border (void)
+static void fill_line_border (int lineno)
 {
        int lastpos = visible_left_border;
        int endpos = visible_left_border + gfxvidinfo.drawbuffer.inwidth;
 
+       if (lineno < visible_top_start || lineno >= visible_bottom_stop) {
+               int b = hposblank;
+               hposblank = 3;
+               fill_line2(lastpos, gfxvidinfo.drawbuffer.inwidth);
+               hposblank = b;
+               return;
+       }
+
        // full hblank
        if (hposblank) {
                hposblank = 3;
@@ -2594,18 +2630,18 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
                                // blanked border line
                                int tmp = hposblank;
                                hposblank = 1;
-                               fill_line_border ();
+                               fill_line_border(lineno);
                                hposblank = tmp;
                        } else {
                                // normal border line
-                               fill_line_border ();
+                               fill_line_border(lineno);
                        }
 
                        do_flush_line (vb, gfx_ypos);
                        if (do_double) {
                                if (dh == dh_buf) {
                                        xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_bytes;
-                                       fill_line_border ();
+                                       fill_line_border(lineno);
                                }
                                /* If dh == dh_line, do_flush_line will re-use the rendered line
                                * from linemem.  */
@@ -2648,7 +2684,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
                // top or bottom blanking region
                int tmp = hposblank;
                hposblank = 1;
-               fill_line_border ();
+               fill_line_border(lineno);
                hposblank = tmp;
                do_flush_line(vb, gfx_ypos);
 
@@ -2740,16 +2776,6 @@ static void center_image (void)
        gfxvidinfo.drawbuffer.xoffset = (DISPLAY_LEFT_SHIFT << RES_MAX) + (visible_left_border << (RES_MAX - currprefs.gfx_resolution));
        gfxvidinfo.drawbuffer.yoffset = thisframe_y_adjust << VRES_MAX;
 
-       struct gfx_filterdata *f = &currprefs.gf[0];
-       if (f->gfx_filter_left_border > 0 && f->gfx_filter_left_border > visible_left_border)
-               visible_left_border = f->gfx_filter_left_border;
-       if (f->gfx_filter_right_border > 0 && f->gfx_filter_right_border < visible_right_border)
-               visible_right_border = f->gfx_filter_right_border;
-       if (f->gfx_filter_top_border > 0 && f->gfx_filter_top_border > visible_top_start)
-               visible_top_start = f->gfx_filter_top_border;
-       if (f->gfx_filter_bottom_border > 0 && f->gfx_filter_bottom_border < visible_bottom_stop)
-               visible_bottom_stop = f->gfx_filter_bottom_border;
-
        center_reset = false;
        horizontal_changed = false;
        vertical_changed = false;
index 306ca0f1dcc28b80f3ccea3055820ab9def17f33..a1510c295ff93c08d9e15da3a196f98b00c39420 100644 (file)
@@ -205,6 +205,8 @@ enum { CP_GENERIC = 1, CP_CDTV, CP_CDTVCR, CP_CD32, CP_A500, CP_A500P, CP_A600,
 #define AUTOSCALE_HALF_INTEGER 9
 #define AUTOSCALE_INTEGER_AUTOSCALE 10
 #define AUTOSCALE_HALF_INTEGER_AUTOSCALE 11
+#define AUTOSCALE_SEPARATOR 12
+#define AUTOSCALE_OVERSCAN_BLANK 13
 
 #define MONITOREMU_NONE 0
 #define MONITOREMU_AUTO 1
index 8208f1d66c6f24244292d93ac3191e45bc47a8ba..d3ca873752662c2d4ed213ab51b5aec61ec56016 100644 (file)
@@ -224,6 +224,9 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
 
        int scalemode = currprefs.gf[picasso_on].gfx_filter_autoscale;
        int oscalemode = changed_prefs.gf[picasso_on].gfx_filter_autoscale;
+       if (scalemode == AUTOSCALE_OVERSCAN_BLANK) {
+               oscalemode = scalemode = AUTOSCALE_NONE;
+       }
 
        if (!specialmode && scalemode == AUTOSCALE_STATIC_AUTO) {
                if (currprefs.gfx_apmode[0].gfx_fullscreen) {
@@ -509,17 +512,22 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                        if (currprefs.gf[picasso_on].gfx_filter_keep_aspect || currprefs.gf[picasso_on].gfx_filter_aspect != 0) {
 
                                if (currprefs.gf[picasso_on].gfx_filter_keep_aspect) {
-                                       if (currprefs.ntscmode) {
-                                               dstratio = dstratio * 1.21f;
-                                               if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 2 && ispal ())
+                                       if (isvga()) {
+                                               if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 1)
                                                        dstratio = dstratio * 0.93f;
-                                               else if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 1 && !ispal ())
-                                                       dstratio = dstratio * 0.98f;
                                        } else {
-                                               if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 2 && ispal ())
-                                                       dstratio = dstratio * 0.95f;
-                                               else if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 1 && !ispal ())
-                                                       dstratio = dstratio * 0.95f;
+                                               if (currprefs.ntscmode) {
+                                                       dstratio = dstratio * 1.21f;
+                                                       if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 2 && ispal ())
+                                                               dstratio = dstratio * 0.93f;
+                                                       else if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 1 && !ispal ())
+                                                               dstratio = dstratio * 0.98f;
+                                               } else {
+                                                       if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 2 && ispal ())
+                                                               dstratio = dstratio * 0.95f;
+                                                       else if (currprefs.gf[picasso_on].gfx_filter_keep_aspect == 1 && !ispal ())
+                                                               dstratio = dstratio * 0.95f;
+                                               }
                                        }
                                }
                                aspect = true;
@@ -641,6 +649,8 @@ end:
                OffsetRect (dr, mrsx, mrsy);
        }
 
+       check_custom_limits();
+
        fpux_restore (&fpuv);
 
 #if 0