vcl/source/opengl/OpenGLHelper.cxx | 5 +++++ vcl/win/gdi/gdiimpl.cxx | 3 ++- vcl/win/gdi/salbmp.cxx | 7 ++++--- vcl/win/gdi/salvd.cxx | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-)
New commits: commit a525438eb62f59801899c5ea45e451963b2ec248 Author: Noel Grandin <noelgran...@collabora.co.uk> AuthorDate: Wed Jan 22 09:50:43 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jan 22 10:54:03 2025 +0100 fix GDI and Quartz backends regression from commit 828a0dcdf6fd1600baaf3103583633006a90d9f9 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 16 08:23:19 2025 +0200 ScanlineDirection is unnecessary Change-Id: I5bc9dc8fc1ad74fb75a2656a97f5c994e9be5bc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index c0ab64b8ab7f..7dd10addea1d 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -569,8 +569,13 @@ BitmapEx OpenGLHelper::ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, t size_t nCurPos = 0; for( tools::Long y = 0; y < nHeight; ++y) { +#ifdef _WIN32 Scanline pScan = pWriteAccess->GetScanline(y); Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(y); +#else + Scanline pScan = pWriteAccess->GetScanline(nHeight-1-y); + Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(nHeight-1-y); +#endif for( tools::Long x = 0; x < nWidth; ++x ) { *pScan++ = pBuffer[nCurPos]; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index beb3834459ec..e72414f70abb 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -538,10 +538,11 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa WinSalBitmap::ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD ); const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS ); + int nHeight = -pBI->bmiHeader.biHeight; // height is negative for top-down bitmap StretchDIBits( hDC, static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), - static_cast<int>(rPosAry.mnSrcX), static_cast<int>(pBI->bmiHeader.biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY), + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(nHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY), static_cast<int>(rPosAry.mnSrcWidth), static_cast<int>(rPosAry.mnSrcHeight), pBits, pBI, DIB_RGB_COLORS, nDrawMode ); diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx index 8b68d5d5658b..1008cb83da30 100644 --- a/vcl/win/gdi/salbmp.cxx +++ b/vcl/win/gdi/salbmp.cxx @@ -517,10 +517,11 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics ) if( pBI->bmiHeader.biBitCount == 1 ) { - hNewDDB = CreateBitmap( pBI->bmiHeader.biWidth, pBI->bmiHeader.biHeight, 1, 1, nullptr ); + int nHeight = -pBI->bmiHeader.biHeight; // height is negative for top-down bitmap + hNewDDB = CreateBitmap( pBI->bmiHeader.biWidth, nHeight, 1, 1, nullptr ); if( hNewDDB ) - SetDIBits( hDC, hNewDDB, 0, pBI->bmiHeader.biHeight, pBits, pBI, DIB_RGB_COLORS ); + SetDIBits( hDC, hNewDDB, 0, nHeight, pBits, pBI, DIB_RGB_COLORS ); } else hNewDDB = CreateDIBitmap( hDC, &pBI->bmiHeader, CBM_INIT, pBits, pBI, DIB_RGB_COLORS ); @@ -687,7 +688,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB(const Size& rSize, vcl::PixelFormat ePixelFo pBIH->biSize = sizeof( BITMAPINFOHEADER ); pBIH->biWidth = rSize.Width(); - pBIH->biHeight = rSize.Height(); + pBIH->biHeight = -rSize.Height(); // negative for top-down bitmap pBIH->biPlanes = 1; pBIH->biBitCount = nBits; pBIH->biCompression = BI_RGB; diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index 2f6d3456a748..9d87ed82425a 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -33,6 +33,8 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, tools::Long nDY, sal_uInt16 nBitCount, void **ppData) { + assert(nDX >= 0); + assert(nDY >= 0); HBITMAP hBitmap; if ( nBitCount == 1 ) @@ -52,7 +54,7 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, to BITMAPINFO aBitmapInfo; aBitmapInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); aBitmapInfo.bmiHeader.biWidth = nDX; - aBitmapInfo.bmiHeader.biHeight = nDY; + aBitmapInfo.bmiHeader.biHeight = -nDY; // negative for top-down aBitmapInfo.bmiHeader.biPlanes = 1; aBitmapInfo.bmiHeader.biBitCount = nBitCount; aBitmapInfo.bmiHeader.biCompression = BI_RGB;