summaryrefslogtreecommitdiff
path: root/vcl/win/gdi
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@collabora.co.uk>2025-02-04 21:59:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2025-02-05 06:15:10 +0100
commitc4edd3e223eb49b914a99b6345df41565a082808 (patch)
treed742a18233763993c5ec62aac94aaa29adeaf556 /vcl/win/gdi
parent8dc9d06735684dd217c6258fe02ef373426456dd (diff)
remove dithering from Windows GDI backend
This has not been necessary for some years now. In the unlikely event that we run on a 256-color display, the OS and the graphics driver will do the dithering for us. Change-Id: I23c7a3ded6ea63fcd0a5239bbf2a2cc91bba306f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181143 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/win/gdi')
-rw-r--r--vcl/win/gdi/gdiimpl.cxx183
-rw-r--r--vcl/win/gdi/salbmp.cxx11
-rw-r--r--vcl/win/gdi/salfont.cxx13
-rw-r--r--vcl/win/gdi/salgdi.cxx323
-rw-r--r--vcl/win/gdi/salvd.cxx15
5 files changed, 11 insertions, 534 deletions
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index dbc0ab48806d..eb4ab2c18972 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -148,62 +148,6 @@ Color ImplGetROPColor( SalROPColor nROPColor )
return nColor;
}
-bool IsDitherColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
-{
- constexpr sal_uInt8 DITHER_PAL_DELTA = 51;
-
- return !(nRed % DITHER_PAL_DELTA) &&
- !(nGreen % DITHER_PAL_DELTA) &&
- !(nBlue % DITHER_PAL_DELTA);
-}
-
-bool IsPaletteColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
-{
- static const PALETTEENTRY aImplSalSysPalEntryAry[] =
- {
- { 0, 0, 0, 0 },
- { 0, 0, 0x80, 0 },
- { 0, 0x80, 0, 0 },
- { 0, 0x80, 0x80, 0 },
- { 0x80, 0, 0, 0 },
- { 0x80, 0, 0x80, 0 },
- { 0x80, 0x80, 0, 0 },
- { 0x80, 0x80, 0x80, 0 },
- { 0xC0, 0xC0, 0xC0, 0 },
- { 0, 0, 0xFF, 0 },
- { 0, 0xFF, 0, 0 },
- { 0, 0xFF, 0xFF, 0 },
- { 0xFF, 0, 0, 0 },
- { 0xFF, 0, 0xFF, 0 },
- { 0xFF, 0xFF, 0, 0 },
- { 0xFF, 0xFF, 0xFF, 0 }
- };
-
- for (const auto& rPalEntry : aImplSalSysPalEntryAry)
- {
- if(rPalEntry.peRed == nRed &&
- rPalEntry.peGreen == nGreen &&
- rPalEntry.peBlue == nBlue)
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool IsExtraColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
-{
- return (nRed == 0) && (nGreen == 184) && (nBlue == 255);
-}
-
-bool ImplIsPaletteEntry(BYTE nRed, BYTE nGreen, BYTE nBlue)
-{
- return IsDitherColor(nRed, nGreen, nBlue) ||
- IsPaletteColor(nRed, nGreen, nBlue) ||
- IsExtraColor(nRed, nGreen, nBlue);
-}
-
} // namespace
WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& rParent):
@@ -1295,17 +1239,9 @@ HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF nPenColor)
HPEN WinSalGraphicsImpl::MakePen(Color nColor)
{
- COLORREF nPenColor = PALETTERGB(nColor.GetRed(),
- nColor.GetGreen(),
- nColor.GetBlue());
-
- if (!mrParent.isPrinter())
- {
- if (GetSalData()->mhDitherPal && ImplIsSysColorEntry(nColor))
- {
- nPenColor = PALRGB_TO_RGB(nPenColor);
- }
- }
+ COLORREF nPenColor = RGB(nColor.GetRed(),
+ nColor.GetGreen(),
+ nColor.GetBlue());
return CreatePen(PS_SOLID, mrParent.mnPenWidth, nPenColor);
}
@@ -1377,112 +1313,14 @@ HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF nBrushColor)
return nullptr;
}
-namespace
-{
-
-BYTE GetDitherMappingValue(BYTE nVal, BYTE nThres, const SalData* pSalData)
-{
- return (pSalData->mpDitherDiff[nVal] > nThres) ?
- pSalData->mpDitherHigh[nVal] : pSalData->mpDitherLow[nVal];
-}
-
-HBRUSH Make16BitDIBPatternBrush(Color nColor)
-{
- const SalData* pSalData = GetSalData();
-
- const BYTE nRed = nColor.GetRed();
- const BYTE nGreen = nColor.GetGreen();
- const BYTE nBlue = nColor.GetBlue();
-
- static const BYTE aOrdDither16Bit[8][8] =
- {
- { 0, 6, 1, 7, 0, 6, 1, 7 },
- { 4, 2, 5, 3, 4, 2, 5, 3 },
- { 1, 7, 0, 6, 1, 7, 0, 6 },
- { 5, 3, 4, 2, 5, 3, 4, 2 },
- { 0, 6, 1, 7, 0, 6, 1, 7 },
- { 4, 2, 5, 3, 4, 2, 5, 3 },
- { 1, 7, 0, 6, 1, 7, 0, 6 },
- { 5, 3, 4, 2, 5, 3, 4, 2 }
- };
-
- BYTE* pTmp = pSalData->mpDitherDIBData;
-
- for(int nY = 0; nY < 8; ++nY)
- {
- for(int nX = 0; nX < 8; ++nX)
- {
- const BYTE nThres = aOrdDither16Bit[nY][nX];
- *pTmp++ = GetDitherMappingValue(nBlue, nThres, pSalData);
- *pTmp++ = GetDitherMappingValue(nGreen, nThres, pSalData);
- *pTmp++ = GetDitherMappingValue(nRed, nThres, pSalData);
- }
- }
-
- return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_RGB_COLORS);
-}
-
-HBRUSH Make8BitDIBPatternBrush(Color nColor)
-{
- const SalData* pSalData = GetSalData();
-
- const BYTE nRed = nColor.GetRed();
- const BYTE nGreen = nColor.GetGreen();
- const BYTE nBlue = nColor.GetBlue();
-
- static const BYTE aOrdDither8Bit[8][8] =
- {
- { 0, 38, 9, 48, 2, 40, 12, 50 },
- { 25, 12, 35, 22, 28, 15, 37, 24 },
- { 6, 44, 3, 41, 8, 47, 5, 44 },
- { 32, 19, 28, 16, 34, 21, 31, 18 },
- { 1, 40, 11, 49, 0, 39, 10, 48 },
- { 27, 14, 36, 24, 26, 13, 36, 23 },
- { 8, 46, 4, 43, 7, 45, 4, 42 },
- { 33, 20, 30, 17, 32, 20, 29, 16 }
- };
-
- BYTE* pTmp = pSalData->mpDitherDIBData;
-
- for (int nY = 0; nY < 8; ++nY)
- {
- for (int nX = 0; nX < 8; ++nX)
- {
- const BYTE nThres = aOrdDither8Bit[nY][nX];
- *pTmp = GetDitherMappingValue(nRed, nThres, pSalData) +
- GetDitherMappingValue(nGreen, nThres, pSalData) * 6 +
- GetDitherMappingValue(nBlue, nThres, pSalData) * 36;
- pTmp++;
- }
- }
-
- return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_PAL_COLORS);
-}
-
-} // namespace
-
HBRUSH WinSalGraphicsImpl::MakeBrush(Color nColor)
{
- const SalData* pSalData = GetSalData();
-
const BYTE nRed = nColor.GetRed();
const BYTE nGreen = nColor.GetGreen();
const BYTE nBlue = nColor.GetBlue();
- const COLORREF nBrushColor = PALETTERGB(nRed, nGreen, nBlue);
-
- if (mrParent.isPrinter() || !pSalData->mhDitherDIB)
- return CreateSolidBrush(nBrushColor);
+ const COLORREF nBrushColor = RGB(nRed, nGreen, nBlue);
- if (24 == reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB)->biBitCount)
- return Make16BitDIBPatternBrush(nColor);
-
- if (ImplIsSysColorEntry(nColor))
- return CreateSolidBrush(PALRGB_TO_RGB(nBrushColor));
-
- if (ImplIsPaletteEntry(nRed, nGreen, nBlue))
- return CreateSolidBrush(nBrushColor);
-
- return Make8BitDIBPatternBrush(nColor);
+ return CreateSolidBrush(nBrushColor);
}
void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush)
@@ -1541,14 +1379,9 @@ void WinSalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY )
void WinSalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY, Color nColor )
{
- COLORREF nCol = PALETTERGB( nColor.GetRed(),
- nColor.GetGreen(),
- nColor.GetBlue() );
-
- if ( !mrParent.isPrinter() &&
- GetSalData()->mhDitherPal &&
- ImplIsSysColorEntry( nColor ) )
- nCol = PALRGB_TO_RGB( nCol );
+ COLORREF nCol = RGB( nColor.GetRed(),
+ nColor.GetGreen(),
+ nColor.GetBlue() );
DrawPixelImpl( nX, nY, nCol );
}
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 65960e5cc550..661684ac0084 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -553,14 +553,6 @@ bool WinSalBitmap::Create(const SalBitmap& rSSalBmp, vcl::PixelFormat eNewPixelF
HDC hDC = GetDC( nullptr );
PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize +
ImplGetDIBColorCount( mhDIB ) * sizeof( RGBQUAD );
- SalData* pSalData = GetSalData();
- HPALETTE hOldPal = nullptr;
-
- if ( pSalData->mhDitherPal )
- {
- hOldPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
- RealizePalette( hDC );
- }
if( GetDIBits( hDC, rSalBmp.mhDDB, 0, nLines, pBits, pBI, DIB_RGB_COLORS ) == nLines )
{
@@ -576,9 +568,6 @@ bool WinSalBitmap::Create(const SalBitmap& rSSalBmp, vcl::PixelFormat eNewPixelF
mhDIB = nullptr;
}
- if( hOldPal )
- SelectPalette( hDC, hOldPal, TRUE );
-
ReleaseDC( nullptr, hDC );
return bRet;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 312f5c60b97f..518b7136aa1d 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -648,16 +648,9 @@ hb_blob_t* WinFontFace::GetHbTable(hb_tag_t nTag) const
void WinSalGraphics::SetTextColor( Color nColor )
{
- COLORREF aCol = PALETTERGB( nColor.GetRed(),
- nColor.GetGreen(),
- nColor.GetBlue() );
-
- if( !mbPrinter &&
- GetSalData()->mhDitherPal &&
- ImplIsSysColorEntry( nColor ) )
- {
- aCol = PALRGB_TO_RGB( aCol );
- }
+ COLORREF aCol = RGB( nColor.GetRed(),
+ nColor.GetGreen(),
+ nColor.GetBlue() );
::SetTextColor( getHDC(), aCol );
}
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 978f4cf95309..0e6e033d0c4d 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -43,65 +43,6 @@
#endif
-#define DITHER_PAL_DELTA 51
-#define DITHER_PAL_STEPS 6
-#define DITHER_PAL_COUNT (DITHER_PAL_STEPS*DITHER_PAL_STEPS*DITHER_PAL_STEPS)
-#define DITHER_MAX_SYSCOLOR 16
-#define DITHER_EXTRA_COLORS 1
-
-namespace
-{
-
-struct SysColorEntry
-{
- DWORD nRGB;
- SysColorEntry* pNext;
-};
-
-SysColorEntry* pFirstSysColor = nullptr;
-SysColorEntry* pActSysColor = nullptr;
-
-void DeleteSysColorList()
-{
- SysColorEntry* pEntry = pFirstSysColor;
- pActSysColor = pFirstSysColor = nullptr;
-
- while( pEntry )
- {
- SysColorEntry* pTmp = pEntry->pNext;
- delete pEntry;
- pEntry = pTmp;
- }
-}
-
-} // namespace
-
-// Blue7
-static PALETTEENTRY aImplExtraColor1 =
-{
- 0, 184, 255, 0
-};
-
-static PALETTEENTRY aImplSalSysPalEntryAry[ DITHER_MAX_SYSCOLOR ] =
-{
-{ 0, 0, 0, 0 },
-{ 0, 0, 0x80, 0 },
-{ 0, 0x80, 0, 0 },
-{ 0, 0x80, 0x80, 0 },
-{ 0x80, 0, 0, 0 },
-{ 0x80, 0, 0x80, 0 },
-{ 0x80, 0x80, 0, 0 },
-{ 0x80, 0x80, 0x80, 0 },
-{ 0xC0, 0xC0, 0xC0, 0 },
-{ 0, 0, 0xFF, 0 },
-{ 0, 0xFF, 0, 0 },
-{ 0, 0xFF, 0xFF, 0 },
-{ 0xFF, 0, 0, 0 },
-{ 0xFF, 0, 0xFF, 0 },
-{ 0xFF, 0xFF, 0, 0 },
-{ 0xFF, 0xFF, 0xFF, 0 }
-};
-
// we must create pens with 1-pixel width; otherwise the S3-graphics card
// map has many paint problems when drawing polygons/polyLines and a
// complex is set
@@ -137,152 +78,6 @@ void ImplInitSalGDI()
// initialize temporary font lists
pSalData->mpSharedTempFontItem = nullptr;
pSalData->mpOtherTempFontItem = nullptr;
-
- // support palettes for 256 color displays
- HDC hDC = GetDC( nullptr );
- int nBitsPixel = GetDeviceCaps( hDC, BITSPIXEL );
- int nPlanes = GetDeviceCaps( hDC, PLANES );
- int nRasterCaps = GetDeviceCaps( hDC, RASTERCAPS );
- int nBitCount = nBitsPixel * nPlanes;
-
- if ( (nBitCount > 8) && (nBitCount < 24) )
- {
- // test if we have to dither
- HDC hMemDC = ::CreateCompatibleDC( hDC );
- HBITMAP hMemBmp = ::CreateCompatibleBitmap( hDC, 8, 8 );
- HBITMAP hBmpOld = static_cast<HBITMAP>(::SelectObject( hMemDC, hMemBmp ));
- HBRUSH hMemBrush = ::CreateSolidBrush( PALETTERGB( 175, 171, 169 ) );
- HBRUSH hBrushOld = static_cast<HBRUSH>(::SelectObject( hMemDC, hMemBrush ));
- bool bDither16 = true;
-
- ::PatBlt( hMemDC, 0, 0, 8, 8, PATCOPY );
- const COLORREF aCol( ::GetPixel( hMemDC, 0, 0 ) );
-
- for( int nY = 0; ( nY < 8 ) && bDither16; nY++ )
- for( int nX = 0; ( nX < 8 ) && bDither16; nX++ )
- if( ::GetPixel( hMemDC, nX, nY ) != aCol )
- bDither16 = false;
-
- ::SelectObject( hMemDC, hBrushOld );
- ::DeleteObject( hMemBrush );
- ::SelectObject( hMemDC, hBmpOld );
- ::DeleteObject( hMemBmp );
- ::DeleteDC( hMemDC );
-
- if( bDither16 )
- {
- // create DIBPattern for 16Bit dithering
- tools::Long n;
-
- pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( BITMAPINFOHEADER ) + 192 );
- pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( pSalData->mhDitherDIB ));
- pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
- pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
- pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
- pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER );
- memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
-
- BITMAPINFOHEADER* pBIH = reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB);
-
- pBIH->biSize = sizeof( BITMAPINFOHEADER );
- pBIH->biWidth = 8;
- pBIH->biHeight = 8;
- pBIH->biPlanes = 1;
- pBIH->biBitCount = 24;
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherDiff[ n ] = n - ( n & 248L );
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherLow[ n ] = static_cast<BYTE>( n & 248 );
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherHigh[ n ] = static_cast<BYTE>(std::min( pSalData->mpDitherLow[ n ] + 8, 255 ));
- }
- }
- else if ( (nRasterCaps & RC_PALETTE) && (nBitCount == 8) )
- {
- BYTE nRed, nGreen, nBlue;
- BYTE nR, nG, nB;
- PALETTEENTRY* pPalEntry;
- LOGPALETTE* pLogPal;
- const sal_uInt16 nDitherPalCount = DITHER_PAL_COUNT;
- sal_uLong nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS;
-
- // create logical palette
- pLogPal = reinterpret_cast<LOGPALETTE*>(new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ]);
- pLogPal->palVersion = 0x0300;
- pLogPal->palNumEntries = static_cast<sal_uInt16>(nTotalCount);
- pPalEntry = pLogPal->palPalEntry;
-
- // Standard colors
- memcpy( pPalEntry, aImplSalSysPalEntryAry, DITHER_MAX_SYSCOLOR * sizeof( PALETTEENTRY ) );
- pPalEntry += DITHER_MAX_SYSCOLOR;
-
- // own palette (6/6/6)
- for( nB=0, nBlue=0; nB < DITHER_PAL_STEPS; nB++, nBlue += DITHER_PAL_DELTA )
- {
- for( nG=0, nGreen=0; nG < DITHER_PAL_STEPS; nG++, nGreen += DITHER_PAL_DELTA )
- {
- for( nR=0, nRed=0; nR < DITHER_PAL_STEPS; nR++, nRed += DITHER_PAL_DELTA )
- {
- pPalEntry->peRed = nRed;
- pPalEntry->peGreen = nGreen;
- pPalEntry->peBlue = nBlue;
- pPalEntry->peFlags = 0;
- pPalEntry++;
- }
- }
- }
-
- // insert special 'Blue' as standard drawing color
- *pPalEntry++ = aImplExtraColor1;
-
- // create palette
- pSalData->mhDitherPal = CreatePalette( pLogPal );
- delete[] reinterpret_cast<char*>(pLogPal);
-
- if( pSalData->mhDitherPal )
- {
- // create DIBPattern for 8Bit dithering
- tools::Long const nSize = sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) ) + 64;
- tools::Long n;
-
- pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
- pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( pSalData->mhDitherDIB ));
- pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
- pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
- pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
- pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
- memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
-
- BITMAPINFOHEADER* pBIH = reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB);
- short* pColors = reinterpret_cast<short*>( pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) );
-
- pBIH->biSize = sizeof( BITMAPINFOHEADER );
- pBIH->biWidth = 8;
- pBIH->biHeight = 8;
- pBIH->biPlanes = 1;
- pBIH->biBitCount = 8;
-
- for( n = 0; n < nDitherPalCount; n++ )
- pColors[ n ] = static_cast<short>( n + DITHER_MAX_SYSCOLOR );
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherDiff[ n ] = n % 51;
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherLow[ n ] = static_cast<BYTE>( n / 51 );
-
- for( n = 0; n < 256; n++ )
- pSalData->mpDitherHigh[ n ] = static_cast<BYTE>(std::min( pSalData->mpDitherLow[ n ] + 1, 5 ));
- }
-
- // get system color entries
- ImplUpdateSysColorEntries();
- }
-
- ReleaseDC( nullptr, hDC );
}
void ImplFreeSalGDI()
@@ -315,26 +110,6 @@ void ImplFreeSalGDI()
ImplClearHDCCache( pSalData );
- // delete Ditherpalette, if existing
- if ( pSalData->mhDitherPal )
- {
- DeleteObject( pSalData->mhDitherPal );
- pSalData->mhDitherPal = nullptr;
- }
-
- // delete buffers for dithering DIB patterns, if necessary
- if ( pSalData->mhDitherDIB )
- {
- GlobalUnlock( pSalData->mhDitherDIB );
- GlobalFree( pSalData->mhDitherDIB );
- pSalData->mhDitherDIB = nullptr;
- pSalData->mpDitherDiff.reset();
- pSalData->mpDitherLow.reset();
- pSalData->mpDitherHigh.reset();
- }
-
- DeleteSysColorList();
-
// delete icon cache
SalIcon* pIcon = pSalData->mpFirstIcon;
pSalData->mpFirstIcon = nullptr;
@@ -353,98 +128,6 @@ void ImplFreeSalGDI()
pSalData->mbResourcesAlreadyFreed = true;
}
-int ImplIsSysColorEntry( Color nColor )
-{
- SysColorEntry* pEntry = pFirstSysColor;
- const DWORD nTestRGB = static_cast<DWORD>(RGB( nColor.GetRed(),
- nColor.GetGreen(),
- nColor.GetBlue() ));
-
- while ( pEntry )
- {
- if ( pEntry->nRGB == nTestRGB )
- return TRUE;
- pEntry = pEntry->pNext;
- }
-
- return FALSE;
-}
-
-static int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue )
-{
- // dither color?
- if ( !(nRed % DITHER_PAL_DELTA) && !(nGreen % DITHER_PAL_DELTA) && !(nBlue % DITHER_PAL_DELTA) )
- return TRUE;
-
- PALETTEENTRY* pPalEntry = aImplSalSysPalEntryAry;
-
- // standard palette color?
- for ( sal_uInt16 i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ )
- {
- if( pPalEntry->peRed == nRed && pPalEntry->peGreen == nGreen && pPalEntry->peBlue == nBlue )
- return TRUE;
- }
-
- // extra color?
- if ( aImplExtraColor1.peRed == nRed &&
- aImplExtraColor1.peGreen == nGreen &&
- aImplExtraColor1.peBlue == nBlue )
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void ImplInsertSysColorEntry( int nSysIndex )
-{
- const DWORD nRGB = GetSysColor( nSysIndex );
-
- if ( ImplIsPaletteEntry( GetRValue( nRGB ), GetGValue( nRGB ), GetBValue( nRGB ) ) )
- return;
-
- if ( !pFirstSysColor )
- {
- pActSysColor = pFirstSysColor = new SysColorEntry;
- pFirstSysColor->nRGB = nRGB;
- pFirstSysColor->pNext = nullptr;
- }
- else
- {
- pActSysColor = pActSysColor->pNext = new SysColorEntry;
- pActSysColor->nRGB = nRGB;
- pActSysColor->pNext = nullptr;
- }
-}
-
-void ImplUpdateSysColorEntries()
-{
- DeleteSysColorList();
-
- // create new sys color list
- ImplInsertSysColorEntry( COLOR_ACTIVEBORDER );
- ImplInsertSysColorEntry( COLOR_INACTIVEBORDER );
- ImplInsertSysColorEntry( COLOR_GRADIENTACTIVECAPTION );
- ImplInsertSysColorEntry( COLOR_GRADIENTINACTIVECAPTION );
- ImplInsertSysColorEntry( COLOR_3DFACE );
- ImplInsertSysColorEntry( COLOR_3DHILIGHT );
- ImplInsertSysColorEntry( COLOR_3DLIGHT );
- ImplInsertSysColorEntry( COLOR_3DSHADOW );
- ImplInsertSysColorEntry( COLOR_3DDKSHADOW );
- ImplInsertSysColorEntry( COLOR_INFOBK );
- ImplInsertSysColorEntry( COLOR_INFOTEXT );
- ImplInsertSysColorEntry( COLOR_BTNTEXT );
- ImplInsertSysColorEntry( COLOR_WINDOW );
- ImplInsertSysColorEntry( COLOR_WINDOWTEXT );
- ImplInsertSysColorEntry( COLOR_HIGHLIGHT );
- ImplInsertSysColorEntry( COLOR_HIGHLIGHTTEXT );
- ImplInsertSysColorEntry( COLOR_MENU );
- ImplInsertSysColorEntry( COLOR_MENUTEXT );
- ImplInsertSysColorEntry( COLOR_ACTIVECAPTION );
- ImplInsertSysColorEntry( COLOR_CAPTIONTEXT );
- ImplInsertSysColorEntry( COLOR_INACTIVECAPTION );
- ImplInsertSysColorEntry( COLOR_INACTIVECAPTIONTEXT );
-}
void WinSalGraphics::InitGraphics()
{
@@ -513,12 +196,6 @@ HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
// create new DC with DefaultBitmap
pC->mhDC = CreateCompatibleDC( hDC );
- if( pSalData->mhDitherPal )
- {
- pC->mhDefPal = SelectPalette( pC->mhDC, pSalData->mhDitherPal, TRUE );
- RealizePalette( pC->mhDC );
- }
-
pC->mhSelBmp = CreateCompatibleBitmap( hDC, CACHED_HDC_DEFEXT, CACHED_HDC_DEFEXT );
pC->mhDefBmp = static_cast<HBITMAP>(SelectObject( pC->mhDC, pC->mhSelBmp ));
diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 7465d56570cb..1903bfd3a533 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -91,8 +91,6 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
nDX, nDY, nBitCount,
&o3tl::temporary<void*>(nullptr));
- const SalData* pSalData = GetSalData();
-
WinSalVirtualDevice* pVDev = new WinSalVirtualDevice(hDC, hBmp, nBitCount,
/*bForeignDC*/false, nDX, nDY);
@@ -103,12 +101,6 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
pVirGraphics->SetLayout( SalLayoutFlags::NONE );
pVirGraphics->setHDC(hDC);
- if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
- {
- pVirGraphics->setPalette(pSalData->mhDitherPal);
- RealizePalette( hDC );
- }
-
pVDev->setGraphics(pVirGraphics);
return std::unique_ptr<SalVirtualDevice>(pVDev);
@@ -138,7 +130,6 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
const sal_uInt16 nBitCount = 0;
const bool bForeignDC = rData.hDC != nullptr;
- const SalData* pSalData = GetSalData();
WinSalVirtualDevice* pVDev = new WinSalVirtualDevice(hDC, /*hBmp*/nullptr, nBitCount,
bForeignDC, nDX, nDY);
@@ -150,12 +141,6 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
pVirGraphics->SetLayout( SalLayoutFlags::NONE );
pVirGraphics->setHDC(hDC);
- if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
- {
- pVirGraphics->setPalette(pSalData->mhDitherPal);
- RealizePalette( hDC );
- }
-
pVDev->setGraphics(pVirGraphics);
return std::unique_ptr<SalVirtualDevice>(pVDev);