From 60aedec5d28a349ec3240b58198656af7cbf1f6b Mon Sep 17 00:00:00 2001 From: SuuperW Date: Tue, 17 Jul 2018 11:38:59 -0500 Subject: [PATCH] Scale HUD when using DirectDraw. (fix regression from commit 5906d44) --- desmume/src/frontend/windows/main.cpp | 56 +++++++++++++-------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index ca2614261..5e518a02a 100755 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -1819,27 +1819,26 @@ static void DD_DoDisplay() ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight()); } - switch(ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount) + switch (ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount) { - case 32: - doRotate(ddraw.surfDescBack.lpSurface); - break; - case 24: - doRotate(ddraw.surfDescBack.lpSurface); - break; - case 16: - if(ddraw.surfDescBack.ddpfPixelFormat.dwGBitMask != 0x3E0) - doRotate(ddraw.surfDescBack.lpSurface); - else - doRotate(ddraw.surfDescBack.lpSurface); - break; - default: - { - if(ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount != 0) - INFO("Unsupported color depth: %i bpp\n", ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount); - //emu_halt(); - } - break; + case 32: + doRotate(ddraw.surfDescBack.lpSurface); + break; + case 24: + doRotate(ddraw.surfDescBack.lpSurface); + break; + case 16: + if (ddraw.surfDescBack.ddpfPixelFormat.dwGBitMask != 0x3E0) + doRotate(ddraw.surfDescBack.lpSurface); + else + doRotate(ddraw.surfDescBack.lpSurface); + break; + case 0: + break; + default: + INFO("Unsupported color depth: %i bpp\n", ddraw.surfDescBack.ddpfPixelFormat.dwRGBBitCount); + //emu_halt(); + break; } 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 - video.filter(); + video.filter(); + + // draw hud + aggDraw.hud->clear(); + DoDisplay_DrawHud(); 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(), 0, 0, video.width, video.height); gldisplay.kill(); DD_DoDisplay(); } else { - //other cases..? OGL_DoDisplay(); } }