mirror of
https://github.com/LIV2/WinUAE.git
synced 2025-12-06 00:12:52 +00:00
Update hardware mouse cursor if texture was reallocated.
This commit is contained in:
parent
a97c44caf4
commit
6a790fb2db
@ -2173,7 +2173,7 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender, int monid
|
||||
|
||||
MatrixTranslation (&d3d->m_matView_out, tx, ty, 1.0f);
|
||||
|
||||
MatrixScaling (&d3d->m_matWorld_out, sw + 0.5f / sw, sh + 0.5f / sh, 1.0f);
|
||||
MatrixScaling (&d3d->m_matWorld_out, sw, sh, 1.0f);
|
||||
|
||||
struct amigadisplay *ad = &adisplays[monid];
|
||||
int rota = currprefs.gf[ad->picasso_on ? GF_RTG : ad->interlace_on ? GF_INTERLACE : GF_NORMAL].gfx_filter_rotation;
|
||||
@ -4171,9 +4171,12 @@ static int xD3D_isenabled(int monid)
|
||||
return d3d->d3d_enabled ? 1 : 0;
|
||||
}
|
||||
|
||||
static uae_u8 *xD3D_setcursorsurface(int monid, int *pitch)
|
||||
static uae_u8 *xD3D_setcursorsurface(int monid, bool query, int *pitch)
|
||||
{
|
||||
struct d3dstruct *d3d = &d3ddata[monid];
|
||||
if (query) {
|
||||
return d3d->cursorsurfaced3dtexbuf;
|
||||
}
|
||||
if (pitch) {
|
||||
*pitch = CURSORMAXWIDTH * 4;
|
||||
return d3d->cursorsurfaced3dtexbuf;
|
||||
|
||||
@ -24,7 +24,7 @@ extern void(*D3D_clear)(int);
|
||||
extern int(*D3D_canshaders)(void);
|
||||
extern int(*D3D_goodenough)(void);
|
||||
extern bool(*D3D_setcursor)(int, int x, int y, int width, int height, float mx, float my, bool visible, bool noscale);
|
||||
extern uae_u8 *(*D3D_setcursorsurface)(int, int *pitch);
|
||||
extern uae_u8 *(*D3D_setcursorsurface)(int, bool, int *pitch);
|
||||
extern float(*D3D_getrefreshrate)(int);
|
||||
extern void(*D3D_restore)(int, bool);
|
||||
extern void(*D3D_resize)(int, int);
|
||||
|
||||
@ -62,7 +62,7 @@ void (*D3D_clear)(int);
|
||||
int (*D3D_canshaders)(void);
|
||||
int (*D3D_goodenough)(void);
|
||||
bool (*D3D_setcursor)(int, int x, int y, int width, int height, float mx, float my, bool visible, bool noscale);
|
||||
uae_u8 *(*D3D_setcursorsurface)(int, int *pitch);
|
||||
uae_u8 *(*D3D_setcursorsurface)(int, bool, int *pitch);
|
||||
float (*D3D_getrefreshrate)(int);
|
||||
void(*D3D_restore)(int, bool);
|
||||
void(*D3D_resize)(int, int);
|
||||
@ -205,6 +205,7 @@ struct d3d11sprite
|
||||
bool screenlimit;
|
||||
uae_u8 *texbuf;
|
||||
bool updated;
|
||||
bool empty;
|
||||
};
|
||||
|
||||
struct d3doverlay
|
||||
@ -1929,6 +1930,7 @@ static bool allocsprite(struct d3d11struct *d3d, struct d3d11sprite *s, int widt
|
||||
s->alpha = alpha;
|
||||
s->rotation = rotation;
|
||||
s->screenlimit = screenlimit;
|
||||
s->empty = true;
|
||||
|
||||
if (screenlimit) {
|
||||
s->texbuf = xcalloc(uae_u8, width * height * 4);
|
||||
@ -5344,6 +5346,7 @@ static void updatecursorsurface(int monid)
|
||||
}
|
||||
|
||||
sp->updated = false;
|
||||
sp->empty = false;
|
||||
D3D11_MAPPED_SUBRESOURCE map;
|
||||
HRESULT hr = d3d->m_deviceContext->Map(sp->texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
|
||||
if (SUCCEEDED(hr)) {
|
||||
@ -5425,16 +5428,20 @@ static bool xD3D_setcursor(int monid, int x, int y, int width, int height, float
|
||||
return true;
|
||||
}
|
||||
|
||||
static uae_u8 *xD3D_setcursorsurface(int monid, int *pitch)
|
||||
static uae_u8 *xD3D_setcursorsurface(int monid, bool query, int *pitch)
|
||||
{
|
||||
struct d3d11struct *d3d = &d3d11data[monid];
|
||||
if (!d3d->hwsprite.texbuf)
|
||||
d3d->hwsprite.updated = false;
|
||||
if (query) {
|
||||
return d3d->hwsprite.empty ? NULL : d3d->hwsprite.texbuf;
|
||||
}
|
||||
if (!d3d->hwsprite.texbuf) {
|
||||
return NULL;
|
||||
}
|
||||
if (pitch) {
|
||||
*pitch = d3d->hwsprite.width * 4;
|
||||
return d3d->hwsprite.texbuf;
|
||||
}
|
||||
d3d->hwsprite.updated = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -515,10 +515,14 @@ static bool gdi_setcursor(int monid, int x, int y, int width, int height, float
|
||||
return true;
|
||||
}
|
||||
|
||||
static uae_u8 *gdi_setcursorsurface(int monid, int *pitch)
|
||||
static uae_u8 *gdi_setcursorsurface(int monid, bool query, int *pitch)
|
||||
{
|
||||
struct gdistruct* gdi = &gdidata[monid];
|
||||
|
||||
if (query) {
|
||||
return (uae_u8 *)gdi->cursor.bits;
|
||||
}
|
||||
|
||||
if (gdi->depth < 32) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -790,7 +790,7 @@ static void setupcursor(void)
|
||||
return;
|
||||
gfx_lock ();
|
||||
setupcursor_needed = 1;
|
||||
dptr = D3D_setcursorsurface(rbc->monitor_id, &pitch);
|
||||
dptr = D3D_setcursorsurface(rbc->monitor_id, false, &pitch);
|
||||
if (dptr) {
|
||||
for (int y = 0; y < CURSORMAXHEIGHT; y++) {
|
||||
uae_u8 *p2 = dptr + pitch * y;
|
||||
@ -803,7 +803,7 @@ static void setupcursor(void)
|
||||
memcpy (p2, p1, cursorwidth * bpp);
|
||||
}
|
||||
}
|
||||
D3D_setcursorsurface(rbc->monitor_id, NULL);
|
||||
D3D_setcursorsurface(rbc->monitor_id, false, NULL);
|
||||
setupcursor_needed = 0;
|
||||
P96TRACE_SPR((_T("cursorsurface3d updated\n")));
|
||||
} else {
|
||||
@ -841,6 +841,9 @@ static void mouseupdate(struct AmigaMonitor *mon)
|
||||
}
|
||||
|
||||
if (D3D_setcursor) {
|
||||
if (!D3D_setcursorsurface(mon->monitor_id, true, NULL)) {
|
||||
setupcursor_needed = 1;
|
||||
}
|
||||
if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER) {
|
||||
D3D_setcursor(mon->monitor_id, x, y, WIN32GFX_GetWidth(mon), WIN32GFX_GetHeight(mon), mx, my, cursorvisible, mon->scalepicasso == 2);
|
||||
} else {
|
||||
@ -1095,6 +1098,7 @@ static void setconvert(int monid)
|
||||
vidinfo->orgbformat = state->RGBFormat;
|
||||
}
|
||||
vidinfo->full_refresh = 1;
|
||||
setupcursor_needed = 1;
|
||||
unlockrtg();
|
||||
}
|
||||
|
||||
@ -1796,7 +1800,11 @@ static uae_u32 REGPARAM2 picasso_SetSpriteColor (TrapContext *ctx)
|
||||
return 0;
|
||||
if (idx >= 4)
|
||||
return 0;
|
||||
uae_u32 oc = cursorrgb[idx];
|
||||
cursorrgb[idx] = (red << 16) | (green << 8) | (blue << 0);
|
||||
if (oc != cursorrgb[idx]) {
|
||||
setupcursor_needed = 1;
|
||||
}
|
||||
P96TRACE_SPR ((_T("SetSpriteColor(%08x,%d:%02X%02X%02X). %x\n"), bi, idx, red, green, blue, bi + PSSO_BoardInfo_MousePens));
|
||||
return 1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user