From 0c8d2c747ac17f8c5b42d78abc31f880cd5a7fbf Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 25 Feb 2017 17:59:33 +0200 Subject: [PATCH] statusbar internal changes. --- drawing.cpp | 4 ++-- include/statusline.h | 2 +- od-win32/direct3d.cpp | 22 ++++++++++++++-------- od-win32/picasso96_win.cpp | 2 +- od-win32/win32_scaler.cpp | 2 +- statusline.cpp | 9 +++++---- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 9d248067..bb504cb3 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2772,7 +2772,7 @@ static void do_color_changes (line_draw_func worker_border, line_draw_func worke if (i == dip_for_drawing->last_color_change) nextpos = endpos; else - nextpos = coord_hw_to_window_x (curr_color_changes[i].linepos); + nextpos = shres_coord_hw_to_window_x (curr_color_changes[i].linepos); nextpos_in_range = nextpos; if (nextpos > endpos) @@ -3747,7 +3747,7 @@ static void finish_drawing_frame (void) if (currprefs.leds_on_screen && ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !(currprefs.leds_on_screen & STATUSLINE_TARGET))) { int slx, sly; - statusline_getpos(&slx, &sly, vb->outwidth, vb->outheight); + statusline_getpos(&slx, &sly, vb->outwidth, vb->outheight, 1, 1); statusbar_y1 = sly + min_ypos_for_screen - 1; statusbar_y2 = statusbar_y1 + TD_TOTAL_HEIGHT + 1; draw_status_line(sly, -1); diff --git a/include/statusline.h b/include/statusline.h index 1a03604d..cebe4b74 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -29,7 +29,7 @@ static int td_pos = (TD_RIGHT | TD_BOTTOM); extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); extern void statusline_single_erase(uae_u8 *buf, int bpp, int y, int totalwidth); -extern void statusline_getpos(int *x, int *y, int width, int height); +extern void statusline_getpos(int *x, int *y, int width, int height, int hx, int vx); #define STATUSTYPE_FLOPPY 1 #define STATUSTYPE_DISPLAY 2 diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 2ad8953d..cf3e05a1 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -156,6 +156,7 @@ static int vsync2, guimode, maxscanline, variablerefresh; static int resetcount; static double cursor_x, cursor_y; static bool cursor_v, cursor_scale; +static int statusbar_vx = 1, statusbar_hx = 1; #define NUMVERTICES 8 #define D3DFVF_TLVERTEX D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1 @@ -1315,10 +1316,9 @@ static void updateleds (void) HRESULT hr; static uae_u32 rc[256], gc[256], bc[256], a[256]; static int done; - int i, y; if (!done) { - for (i = 0; i < 256; i++) { + for (int i = 0; i < 256; i++) { rc[i] = i << 16; gc[i] = i << 8; bc[i] = i << 0; @@ -1331,15 +1331,21 @@ static void updateleds (void) write_log (_T("%d: SL LockRect failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return; } - for (y = 0; y < TD_TOTAL_HEIGHT; y++) { + + for (int y = 0; y < TD_TOTAL_HEIGHT * statusbar_vx; y++) { uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; - statusline_single_erase(buf, 32 / 8, y, ledwidth); + statusline_single_erase(buf, 32 / 8, y, ledwidth * statusbar_hx); } statusline_render((uae_u8*)locked.pBits, 32 / 8, locked.Pitch, ledwidth, ledheight, rc, gc, bc, a); - for (y = 0; y < TD_TOTAL_HEIGHT; y++) { - uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; + + int y = 0; + for (int yy = 0; yy < statusbar_vx * TD_TOTAL_HEIGHT; yy++) { + uae_u8 *buf = (uae_u8*)locked.pBits + yy * locked.Pitch; draw_status_line_single (buf, 32 / 8, y, ledwidth, rc, gc, bc, a); + if ((yy % statusbar_vx) == 0) + y++; } + ledtexture->UnlockRect (0); } @@ -1347,7 +1353,7 @@ static int createledtexture (void) { ledwidth = window_w; ledheight = TD_TOTAL_HEIGHT; - ledtexture = createtext (ledwidth, ledheight, D3DFMT_A8R8G8B8); + ledtexture = createtext (ledwidth * statusbar_hx, ledheight * statusbar_vx, D3DFMT_A8R8G8B8); if (!ledtexture) return 0; return 1; @@ -3240,7 +3246,7 @@ static void D3D_render2 (void) } if (ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen ()) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen ()))) { int slx, sly; - statusline_getpos (&slx, &sly, window_w, window_h); + statusline_getpos (&slx, &sly, window_w, window_h, statusbar_hx, statusbar_vx); v.x = slx; v.y = sly; v.z = 0; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index a9e70cff..a8607bb8 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -3985,7 +3985,7 @@ void picasso_statusline (uae_u8 *dst) if (dst_width > picasso_vidinfo.width) dst_width = picasso_vidinfo.width; pitch = picasso_vidinfo.rowbytes; - statusline_getpos (&slx, &sly, picasso96_state.Width, dst_height); + statusline_getpos (&slx, &sly, picasso96_state.Width, dst_height, 1, 1); if (currprefs.gfx_api) statusline_render(dst + sly * pitch, picasso_vidinfo.pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); yy = 0; diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 6ab6956a..cfdd58be 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -721,7 +721,7 @@ static void statusline (void) if (!(currprefs.leds_on_screen & STATUSLINE_CHIPSET) || !tempsurf) return; - statusline_getpos (&slx, &sly, dst_width, dst_height); + statusline_getpos (&slx, &sly, dst_width, dst_height, 1, 1); lx = dst_width; ly = dst_height; SetRect (&sr, slx, 0, slx + lx, TD_TOTAL_HEIGHT); diff --git a/statusline.cpp b/statusline.cpp index bfa6f86e..aae1f6dd 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -19,8 +19,9 @@ * Some code to put status information on the screen. */ -void statusline_getpos (int *x, int *y, int width, int height) +void statusline_getpos (int *x, int *y, int width, int height, int hx, int vx) { + int total_height = TD_TOTAL_HEIGHT * vx; if (currprefs.osd_pos.x >= 20000) { if (currprefs.osd_pos.x >= 30000) *y = width * (currprefs.osd_pos.x - 30000) / 1000; @@ -34,12 +35,12 @@ void statusline_getpos (int *x, int *y, int width, int height) } if (currprefs.osd_pos.y >= 20000) { if (currprefs.osd_pos.y >= 30000) - *y = (height - TD_TOTAL_HEIGHT) * (currprefs.osd_pos.y - 30000) / 1000; + *y = (height - total_height) * (currprefs.osd_pos.y - 30000) / 1000; else - *y = (height - TD_TOTAL_HEIGHT) - ((height - TD_TOTAL_HEIGHT) * (30000 - currprefs.osd_pos.y) / 1000); + *y = (height - total_height) - ((height - total_height) * (30000 - currprefs.osd_pos.y) / 1000); } else { if (currprefs.osd_pos.y >= 0) - *y = height - TD_TOTAL_HEIGHT - currprefs.osd_pos.y; + *y = height - total_height - currprefs.osd_pos.y; else *y = -currprefs.osd_pos.y + 1; } -- 2.47.3