From 62d936aaaaa8eb53536c92cee60e7cb122a098a7 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 7 Mar 2020 14:10:50 +0200 Subject: [PATCH] DFx OSD write protected border. --- statusline.cpp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/statusline.cpp b/statusline.cpp index ed0b644f..ee279a65 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -88,6 +88,7 @@ static uae_u32 rgbmuldiv(uae_u32 rgb, int mul, int div) v /= div; out |= v << (i * 8); } + out |= rgb & 0xff000000; return out; } @@ -109,7 +110,8 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi int side, pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1; int x, c, on = 0, am = 2; xcolnr on_rgb = 0, on_rgb2 = 0, off_rgb = 0, pen_rgb = 0; - int half = 0; + int half = 0, extraborder = 0; + cb = ledcolor(TD_BORDER, rc, gc, bc, alpha); if (!(currprefs.leds_on_screen_mask[ad->picasso_on ? 1 : 0] & (1 << led))) @@ -135,7 +137,8 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi if (gid->df[0] == 0) { pen_rgb = ledcolor(0x00aaaaaa, rc, gc, bc, alpha); } else if (gid->floppy_protected) { - cb = ledcolor(0xff8040, rc, gc, bc, alpha); + cb = ledcolor(0x00cc00, rc, gc, bc, alpha); + extraborder = 1; } } side = gui_data.drive_side; @@ -281,12 +284,19 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi on_rgb |= 0x33000000; off_rgb |= 0x33000000; if (half > 0) { - c = ledcolor (on ? (y >= TD_TOTAL_HEIGHT / 2 ? on_rgb2 : on_rgb) : off_rgb, rc, gc, bc, alpha); + int halfon = y >= TD_TOTAL_HEIGHT / 2; + c = ledcolor(on ? (halfon ? on_rgb2 : on_rgb) : off_rgb, rc, gc, bc, alpha); + if (!halfon && on && extraborder) + cb = rgbmuldiv(cb, 2, 3); } else if (half < 0) { - c = ledcolor (on ? (y < TD_TOTAL_HEIGHT / 2 ? on_rgb2 : on_rgb) : off_rgb, rc, gc, bc, alpha); + int halfon = y < TD_TOTAL_HEIGHT / 2; + c = ledcolor(on ? (halfon ? on_rgb2 : on_rgb) : off_rgb, rc, gc, bc, alpha); + if (!halfon && on && extraborder) + cb = rgbmuldiv(cb, 2, 3); } else { - c = ledcolor (on ? on_rgb : off_rgb, rc, gc, bc, alpha); + c = ledcolor(on ? on_rgb : off_rgb, rc, gc, bc, alpha); } + border = 0; if (y == 0 || y == TD_TOTAL_HEIGHT - 1) { c = cb; @@ -294,12 +304,15 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi } x = x_start + pos * TD_WIDTH; - if (!border) - putpixel (buf, NULL, bpp, x - 1, cb, 0); - for (j = 0; j < TD_LED_WIDTH; j++) - putpixel (buf, NULL, bpp, x + j, c, 0); - if (!border) - putpixel (buf, NULL, bpp, x + j, cb, 0); + if (!border) { + putpixel(buf, NULL, bpp, x - 1, cb, 0); + } + for (j = 0; j < TD_LED_WIDTH; j++) { + putpixel(buf, NULL, bpp, x + j, c, 0); + } + if (!border) { + putpixel(buf, NULL, bpp, x + j, cb, 0); + } if (y >= TD_PADY && y - TD_PADY < TD_NUM_HEIGHT) { if (num3 >= 0) { -- 2.47.3