]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
DFx OSD write protected border.
authorToni Wilen <twilen@winuae.net>
Sat, 7 Mar 2020 12:10:50 +0000 (14:10 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 7 Mar 2020 12:10:50 +0000 (14:10 +0200)
statusline.cpp

index ed0b644fdd7327e365f5e2949a16c4b1f92452d3..ee279a65c210f92441c60b4e5af150aed25693ac 100644 (file)
@@ -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) {