GDI mode statusline update.

This commit is contained in:
Toni Wilen 2022-06-18 22:23:39 +03:00
parent 965e3b1cfa
commit 300603a807
4 changed files with 54 additions and 45 deletions

View File

@ -4208,7 +4208,7 @@ static void init_drawing_frame (void)
static int lightpen_y1[2], lightpen_y2[2];
static int statusbar_y1, statusbar_y2;
void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8, int opaq)
void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8)
{
if (x <= 0)
return;
@ -4231,20 +4231,8 @@ void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8, int op
break;
case 4:
{
int i;
if (1 || opaq || currprefs.gf[0].gfx_filter == 0) {
uae_u32 *p = (uae_u32*)buf + x;
*p = c8;
} else {
for (i = 0; i < 4; i++) {
int v1 = buf[i + bpp * x];
int v2 = (c8 >> (i * 8)) & 255;
v1 = (v1 * 2 + v2 * 3) / 5;
if (v1 > 255)
v1 = 255;
buf[i + bpp * x] = v1;
}
}
uae_u32 *p = (uae_u32*)buf + x;
*p = c8;
break;
}
}
@ -4319,7 +4307,7 @@ static void draw_lightpen_cursor(int monid, int x, int y, int line, int onscreen
for (int i = 0; i < LIGHTPEN_WIDTH; i++) {
int xx = x + i - LIGHTPEN_WIDTH / 2;
if (*p != '-' && xx >= 0 && xx < vidinfo->drawbuffer.outwidth) {
putpixel(xlinebuffer, xlinebuffer_genlock, vidinfo->drawbuffer.pixbytes, xx, *p == 'x' ? xcolors[color1] : xcolors[color2], 1);
putpixel(xlinebuffer, xlinebuffer_genlock, vidinfo->drawbuffer.pixbytes, xx, *p == 'x' ? xcolors[color1] : xcolors[color2]);
}
p++;
}
@ -4429,10 +4417,10 @@ static void refresh_indicator_update(struct vidbuffer *vb)
color2 = refresh_indicator_colors[pixel - 5];
}
for (int x = 0; x < 8; x++) {
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color1], 1);
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color1]);
}
for (int x = 8; x < 16; x++) {
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color2], 1);
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color2]);
}
}
}
@ -4617,7 +4605,7 @@ void draw_lines(int end, int section)
int color = section_toggle ? section_colors[section & 3] : 0;
xlinebuffer = row_map[whereline];
for (int x = 0; x < 4; x++) {
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color], 1);
putpixel(xlinebuffer, NULL, vidinfo->drawbuffer.pixbytes, x, xcolors[color]);
}
}
}

View File

@ -376,7 +376,7 @@ extern void check_custom_limits (void);
extern void get_custom_topedge (int *x, int *y, bool max);
extern void get_custom_raw_limits (int *pw, int *ph, int *pdx, int *pdy);
void get_custom_mouse_limits (int *pw, int *ph, int *pdx, int *pdy, int dbl);
extern void putpixel (uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8, int opaq);
extern void putpixel (uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8);
extern void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int height, int depth);
extern void freevidbuffer(int monid, struct vidbuffer *buf);
extern void check_prefs_picasso(void);

View File

@ -30,6 +30,7 @@ struct gdibm
struct gdistruct
{
int enabled;
int num;
int width, height, depth;
int wwidth, wheight;
@ -200,7 +201,8 @@ static uae_u8 *gdi_locktexture(int monid, int *pitch, int *height, int fullupdat
struct gdistruct *gdi = &gdidata[monid];
if (gdi->bits) {
*pitch = gdi->pitch;
*height = gdi->height;
if (height)
*height = gdi->height;
return (uae_u8*)gdi->bits;
}
return NULL;
@ -239,17 +241,14 @@ static void gdi_showframe(int monid)
StretchBlt(gdi->hdc, 0, 0, gdi->wwidth, gdi->wheight, gdi->thdc, 0, 0, gdi->width, gdi->height, SRCCOPY);
}
if (gdi->osd.active && gdi->osd.hbm) {
BLENDFUNCTION bf = { 0 };
bf.BlendOp = AC_SRC_OVER;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
AlphaBlend(gdi->hdc, gdi->osd.x, gdi->osd.y, gdi->ledwidth, gdi->ledheight, gdi->osd.thdc, 0, 0, gdi->ledwidth, gdi->ledheight, bf);
TransparentBlt(gdi->hdc, gdi->osd.x, gdi->osd.y, gdi->ledwidth, gdi->ledheight, gdi->osd.thdc, 0, 0, gdi->ledwidth, gdi->ledheight, 0x000000);
}
}
void gdi_free(int monid, bool immediate)
{
struct gdistruct *gdi = &gdidata[monid];
gdi->enabled = 0;
freetexture(monid);
}
@ -271,9 +270,31 @@ static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth,
gdi->ledheight = TD_TOTAL_HEIGHT * gdi->statusbar_vx;
allocsprite(gdi, &gdi->osd, gdi->ledwidth, gdi->ledheight);
gdi->enabled = 1;
return NULL;
}
static HDC gdi_getDC(int monid, HDC hdc)
{
struct gdistruct *gdi = &gdidata[monid];
if (!hdc) {
return gdi->hdc;
}
return NULL;
}
static int gdi_isenabled(int monid)
{
struct gdistruct *gdi = &gdidata[monid];
return gdi->enabled ? -1 : 0;
}
static void gdi_clear(int monid)
{
struct gdistruct *gdi = &gdidata[monid];
}
void gdi_select(void)
{
@ -296,9 +317,9 @@ void gdi_select(void)
D3D_showframe = gdi_showframe;
D3D_showframe_special = NULL;
D3D_guimode = gdi_guimode;
D3D_getDC = NULL;
D3D_isenabled = NULL;
D3D_clear = NULL;
D3D_getDC = gdi_getDC;
D3D_isenabled = gdi_isenabled;
D3D_clear = gdi_clear;
D3D_canshaders = NULL;
D3D_goodenough = NULL;
D3D_setcursor = NULL;

View File

@ -90,9 +90,9 @@ static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32
for (j = 0; j < td_numbers_width; j++) {
for (int k = 0; k < mult; k++) {
if (*numptr == 'x')
putpixel(buf, NULL, bpp, x + j * mult + k, c1, 1);
putpixel(buf, NULL, bpp, x + j * mult + k, c1);
else if (*numptr == '+')
putpixel(buf, NULL, bpp, x + j * mult + k, c2, 0);
putpixel(buf, NULL, bpp, x + j * mult + k, c2);
}
numptr++;
}
@ -171,7 +171,7 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
y /= mult;
c1 = ledcolor (0x00ffffff, rc, gc, bc, alpha);
c2 = ledcolor (0x00000000, rc, gc, bc, alpha);
c2 = ledcolor (0x00111111, rc, gc, bc, alpha);
if (td_numbers_pos & TD_RIGHT)
x_start = totalwidth - (td_numbers_padx + VISIBLE_LEDS * td_width) * mult;
@ -252,12 +252,12 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
num2 = -1;
num3 = 16;
on_rgb = 0xcccccc;
off_rgb = 0x000000;
off_rgb = 0x111111;
am = 2;
} else {
int fps = (gui_data.fps + 5) / 10;
on_rgb = 0x000000;
off_rgb = gui_data.fps_color == 1 ? 0xcccc00 : (gui_data.fps_color == 2 ? 0x0000cc : 0x000000);
on_rgb = 0x111111;
off_rgb = gui_data.fps_color == 1 ? 0xcccc00 : (gui_data.fps_color == 2 ? 0x0000cc : 0x111111);
am = 3;
if (gui_data.fps_color >= 2) {
num1 = -1;
@ -289,12 +289,12 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
int idle = (gui_data.idle + 5) / 10;
pos = 1;
on_rgb = 0xcc0000;
off_rgb = 0x000000;
off_rgb = 0x111111;
if (gui_data.cpu_halted) {
idle = 0;
on = 1;
if (gui_data.cpu_halted < 0) {
on_rgb = 0x000000;
on_rgb = 0x111111;
num1 = 16; // PPC
num2 = 16;
num3 = 10;
@ -329,14 +329,14 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
num2 = snd / 10;
num3 = snd % 10;
}
on_rgb = 0x000000;
on_rgb = 0x111111;
if (on < 0)
on_rgb = 0xcccc00; // underflow
else if (on == 2)
on_rgb = 0xcc0000; // really big overflow
else if (on == 1)
on_rgb = 0x0000cc; // "normal" overflow
off_rgb = 0x000000;
off_rgb = 0x111111;
am = 3;
} else if (led == LED_MD) {
// DF3 reused as internal non-volatile ram led (cd32/cdtv)
@ -362,7 +362,7 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
on_rgb |= 0x00cc00;
if (on & 2)
on_rgb |= 0xcc0000;
off_rgb = 0x000000;
off_rgb = 0x111111;
num1 = -1;
num2 = -1;
num3 = 17;
@ -371,8 +371,8 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
} else {
continue;
}
on_rgb |= 0x33000000;
off_rgb |= 0x33000000;
on_rgb |= 0x33111111;
off_rgb |= 0x33111111;
if (half > 0) {
int halfon = y >= TD_TOTAL_HEIGHT / 2;
c = ledcolor(on ? (halfon ? on_rgb2 : on_rgb) : off_rgb, rc, gc, bc, alpha);
@ -396,13 +396,13 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
x = x_start + pos * td_width * mult;
for (int xx = 0; xx < mult; xx++) {
if (!border) {
putpixel(buf, NULL, bpp, x - mult + xx, cb, 0);
putpixel(buf, NULL, bpp, x - mult + xx, cb);
}
for (j = 0; j < td_led_width * mult; j += mult) {
putpixel(buf, NULL, bpp, x + j + xx, c, 0);
putpixel(buf, NULL, bpp, x + j + xx, c);
}
if (!border) {
putpixel(buf, NULL, bpp, x + j + xx, cb, 0);
putpixel(buf, NULL, bpp, x + j + xx, cb);
}
}