Scale HUD when using DirectDraw. (fix regression from commit 5906d44)

This commit is contained in:
SuuperW 2018-07-17 11:38:59 -05:00
parent 6fc7161f19
commit 60aedec5d2
1 changed files with 27 additions and 29 deletions

View File

@ -1819,27 +1819,26 @@ static void DD_DoDisplay()
ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight()); ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight());
} }
switch(ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount) switch (ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount)
{ {
case 32: case 32:
doRotate<u32>(ddraw.surfDescBack.lpSurface); doRotate<u32>(ddraw.surfDescBack.lpSurface);
break; break;
case 24: case 24:
doRotate<pix24>(ddraw.surfDescBack.lpSurface); doRotate<pix24>(ddraw.surfDescBack.lpSurface);
break; break;
case 16: case 16:
if(ddraw.surfDescBack.ddpfPixelFormat.dwGBitMask != 0x3E0) if (ddraw.surfDescBack.ddpfPixelFormat.dwGBitMask != 0x3E0)
doRotate<pix16>(ddraw.surfDescBack.lpSurface); doRotate<pix16>(ddraw.surfDescBack.lpSurface);
else else
doRotate<pix15>(ddraw.surfDescBack.lpSurface); doRotate<pix15>(ddraw.surfDescBack.lpSurface);
break; break;
default: case 0:
{ break;
if(ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount != 0) default:
INFO("Unsupported color depth: %i bpp\n", ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount); INFO("Unsupported color depth: %i bpp\n", ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount);
//emu_halt(); //emu_halt();
} break;
break;
} }
if (!ddraw.unlock()) return; if (!ddraw.unlock()) return;
@ -2010,24 +2009,23 @@ static void DoDisplay()
} }
} }
// draw HUD
if (ddhw || ddsw)
aggDraw.hud->attach((u8*)video.buffer, video.prefilterWidth, video.prefilterHeight, video.prefilterWidth * 4);
else
aggDraw.hud->clear();
DoDisplay_DrawHud();
//apply user's filter //apply user's filter
video.filter(); video.filter();
// draw hud
aggDraw.hud->clear();
DoDisplay_DrawHud();
if(ddhw || ddsw) if(ddhw || ddsw)
{ {
// DirectDraw doesn't support alpha blending, so we must scale and overlay the HUD ourselves.
T_AGG_RGBA target((u8*)video.finalBuffer(), video.width, video.height, video.width * 4);
target.transformImage(aggDraw.hud->image<T_AGG_PF_RGBA>(), 0, 0, video.width, video.height);
gldisplay.kill(); gldisplay.kill();
DD_DoDisplay(); DD_DoDisplay();
} }
else else
{ {
//other cases..?
OGL_DoDisplay(); OGL_DoDisplay();
} }
} }