mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Fixed bitmap orientation for Create*Bitmap functions
Fixes upside-down save game screenshots in Siege of Avalon (issue #42)
This commit is contained in:
parent
b6f6f2acf0
commit
f9f4b6fb00
@ -168,7 +168,7 @@ namespace
|
||||
LOG_FUNC("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
|
||||
if (lpbmih && (!(fdwInit & CBM_INIT) || lpbInit && lpbmi))
|
||||
{
|
||||
HBITMAP bitmap = Gdi::VirtualScreen::createOffScreenDib(lpbmih->biWidth, std::abs(lpbmih->biHeight));
|
||||
HBITMAP bitmap = Gdi::VirtualScreen::createOffScreenDib(lpbmih->biWidth, lpbmih->biHeight);
|
||||
if (bitmap && (fdwInit & CBM_INIT))
|
||||
{
|
||||
SetDIBits(hdc, bitmap, 0, std::abs(lpbmih->biHeight), lpbInit, lpbmi, fuUsage);
|
||||
|
@ -36,7 +36,7 @@ namespace
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HBITMAP createDibSection(DWORD width, DWORD height, HANDLE section)
|
||||
HBITMAP createDibSection(LONG width, LONG height, HANDLE section)
|
||||
{
|
||||
struct BITMAPINFO256 : public BITMAPINFO
|
||||
{
|
||||
@ -46,7 +46,7 @@ namespace
|
||||
BITMAPINFO256 bmi = {};
|
||||
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
|
||||
bmi.bmiHeader.biWidth = width;
|
||||
bmi.bmiHeader.biHeight = -static_cast<LONG>(height);
|
||||
bmi.bmiHeader.biHeight = height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = static_cast<WORD>(g_bpp);
|
||||
bmi.bmiHeader.biCompression = 8 == g_bpp ? BI_RGB : BI_BITFIELDS;
|
||||
@ -107,10 +107,10 @@ namespace Gdi
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return createDibSection(g_width, g_height, g_surfaceFileMapping);
|
||||
return createDibSection(g_width, -g_height, g_surfaceFileMapping);
|
||||
}
|
||||
|
||||
HBITMAP createOffScreenDib(DWORD width, DWORD height)
|
||||
HBITMAP createOffScreenDib(LONG width, LONG height)
|
||||
{
|
||||
Compat::ScopedCriticalSection lock(g_cs);
|
||||
return createDibSection(width, height, nullptr);
|
||||
|
@ -14,7 +14,7 @@ namespace Gdi
|
||||
{
|
||||
HDC createDc();
|
||||
HBITMAP createDib();
|
||||
HBITMAP createOffScreenDib(DWORD width, DWORD height);
|
||||
HBITMAP createOffScreenDib(LONG width, LONG height);
|
||||
CompatPtr<IDirectDrawSurface7> createSurface(const RECT& rect);
|
||||
void deleteDc(HDC dc);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user