diff options
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/source/gdi/salbmp.cxx | 458 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi.cxx | 116 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi2.cxx | 216 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 74 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi_gdiplus.cxx | 207 | ||||
-rw-r--r-- | vcl/win/source/gdi/salnativewidgets-luna.cxx | 6 | ||||
-rw-r--r-- | vcl/win/source/gdi/salprn.cxx | 6 | ||||
-rw-r--r-- | vcl/win/source/gdi/salvd.cxx | 24 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 8 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 72 |
10 files changed, 905 insertions, 282 deletions
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 00ccab05be18..20e60e8c276b 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -19,26 +19,32 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <tools/svwin.h> - #include <vcl/bitmap.hxx> // for BitmapSystemData #include <vcl/salbtype.hxx> - #include <win/wincomp.hxx> #include <win/salgdi.h> #include <win/saldata.hxx> #include <win/salbmp.h> - #include <string.h> +#include <vcl/timer.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <map> + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#include <GdiPlus.h> -// ----------- +// ------------------------------------------------------------------ // - Inlines - -// ----------- inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex ) { @@ -48,14 +54,139 @@ inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex ) ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) ); } -// ---------------- +// ------------------------------------------------------------------ +// Helper class to manage Gdiplus::Bitmap instances inside of +// WinSalBitmap + +struct Comparator +{ + bool operator()(WinSalBitmap* pA, WinSalBitmap* pB) const + { + return pA < pB; + } +}; + +typedef ::std::map< WinSalBitmap*, sal_uInt32, Comparator > EntryMap; +static const sal_uInt32 nDefaultCycles(60); + +class GdiPlusBuffer : protected comphelper::OBaseMutex, public Timer +{ +private: + EntryMap maEntries; + +public: + GdiPlusBuffer() + : Timer(), + maEntries() + { + SetTimeout(1000); + Stop(); + } + + ~GdiPlusBuffer() + { + Stop(); + } + + void addEntry(WinSalBitmap& rEntry) + { + ::osl::MutexGuard aGuard(m_aMutex); + EntryMap::iterator aFound = maEntries.find(&rEntry); + + if(aFound == maEntries.end()) + { + if(maEntries.empty()) + { + Start(); + } + + maEntries[&rEntry] = nDefaultCycles; + } + } + + void remEntry(WinSalBitmap& rEntry) + { + ::osl::MutexGuard aGuard(m_aMutex); + EntryMap::iterator aFound = maEntries.find(&rEntry); + + if(aFound != maEntries.end()) + { + maEntries.erase(aFound); + + if(maEntries.empty()) + { + Stop(); + } + } + } + + void touchEntry(WinSalBitmap& rEntry) + { + ::osl::MutexGuard aGuard(m_aMutex); + EntryMap::iterator aFound = maEntries.find(&rEntry); + + if(aFound != maEntries.end()) + { + aFound->second = nDefaultCycles; + } + } + + // from parent Timer + virtual void Timeout() + { + ::osl::MutexGuard aGuard(m_aMutex); + EntryMap::iterator aIter(maEntries.begin()); + + while(aIter != maEntries.end()) + { + if(aIter->second) + { + aIter->second--; + aIter++; + } + else + { + EntryMap::iterator aDelete(aIter); + WinSalBitmap* pSource = aDelete->first; + aIter++; + maEntries.erase(aDelete); + + if(maEntries.empty()) + { + Stop(); + } + + // delete at WinSalBitmap after entry is removed; this + // way it would not hurt to call remEntry from there, too + if(pSource->maGdiPlusBitmap.get()) + { + pSource->maGdiPlusBitmap.reset(); + } + } + } + + if(!maEntries.empty()) + { + Start(); + } + } +}; + +// ------------------------------------------------------------------ +// Global instance of GdiPlusBuffer which manages Gdiplus::Bitmap +// instances + +static GdiPlusBuffer aGdiPlusBuffer; + +// ------------------------------------------------------------------ // - WinSalBitmap - -// ---------------- -WinSalBitmap::WinSalBitmap() : - mhDIB ( 0 ), - mhDDB ( 0 ), - mnBitCount ( 0 ) +WinSalBitmap::WinSalBitmap() +: maSize(), + mhDIB(0), + mhDDB(0), + maGdiPlusBitmap(), + mnBitCount(0) { } @@ -68,6 +199,292 @@ WinSalBitmap::~WinSalBitmap() // ------------------------------------------------------------------ +void WinSalBitmap::Destroy() +{ + if(maGdiPlusBitmap.get()) + { + aGdiPlusBuffer.remEntry(*this); + } + + if( mhDIB ) + GlobalFree( mhDIB ); + else if( mhDDB ) + DeleteObject( mhDDB ); + + maSize = Size(); + mnBitCount = 0; +} + +// ------------------------------------------------------------------ + +GdiPlusBmpPtr WinSalBitmap::ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource) const +{ + if(maGdiPlusBitmap.get()) + { + aGdiPlusBuffer.touchEntry(const_cast< WinSalBitmap& >(*this)); + } + else + { + if(maSize.Width() > 0 && maSize.Height() > 0) + { + WinSalBitmap* pThat = const_cast< WinSalBitmap* >(this); + + if(pAlphaSource) + { + pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap(*pAlphaSource)); + } + else + { + pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap()); + } + + if(maGdiPlusBitmap.get()) + { + aGdiPlusBuffer.addEntry(*pThat); + } + } + } + + return maGdiPlusBitmap; +} + +// ------------------------------------------------------------------ + +Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap() +{ + Gdiplus::Bitmap* pRetval(0); + WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this); + WinSalBitmap* pExtraWinSalRGB = 0; + + if(!pSalRGB->ImplGethDIB()) + { + // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap + pExtraWinSalRGB = new WinSalBitmap(); + pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount()); + pSalRGB = pExtraWinSalRGB; + } + + BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(true); + BitmapBuffer* pExtraRGB = 0; + + if(pRGB && BMP_FORMAT_24BIT_TC_BGR != (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN)) + { + // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet in that format + SalTwoRect aSalTwoRect; + + aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0; + aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pRGB->mnWidth; + aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pRGB->mnHeight; + + pExtraRGB = StretchAndConvert( + *pRGB, + aSalTwoRect, + BMP_FORMAT_24BIT_TC_BGR, + 0); + + pSalRGB->ReleaseBuffer(pRGB, true); + pRGB = pExtraRGB; + } + + if(pRGB + && pRGB->mnWidth > 0 + && pRGB->mnHeight > 0 + && BMP_FORMAT_24BIT_TC_BGR == (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN)) + { + const sal_uInt32 nW(pRGB->mnWidth); + const sal_uInt32 nH(pRGB->mnHeight); + + pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat24bppRGB); + + if(pRetval) + { + sal_uInt8* pSrcRGB(pRGB->mpBits); + const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); + const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + + for(sal_uInt32 y(0); y < nH; y++) + { + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + + for(sal_uInt32 x(0); x < nW; x++) + { + const sal_uInt8 nB(*pSrcRGB++); + const sal_uInt8 nG(*pSrcRGB++); + const sal_uInt8 nR(*pSrcRGB++); + + pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nR, nG, nB)); + } + + pSrcRGB += nExtraRGB; + } + } + } + + if(pExtraRGB) + { + delete pExtraRGB; + } + else + { + pSalRGB->ReleaseBuffer(pRGB, true); + } + + if(pExtraWinSalRGB) + { + delete pExtraWinSalRGB; + } + + return pRetval; +} + +// ------------------------------------------------------------------ + +Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource) +{ + Gdiplus::Bitmap* pRetval(0); + WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this); + WinSalBitmap* pExtraWinSalRGB = 0; + + if(!pSalRGB->ImplGethDIB()) + { + // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap + pExtraWinSalRGB = new WinSalBitmap(); + pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount()); + pSalRGB = pExtraWinSalRGB; + } + + BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(true); + BitmapBuffer* pExtraRGB = 0; + + if(pRGB && BMP_FORMAT_24BIT_TC_BGR != (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN)) + { + // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet in that format + SalTwoRect aSalTwoRect; + + aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0; + aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pRGB->mnWidth; + aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pRGB->mnHeight; + + pExtraRGB = StretchAndConvert( + *pRGB, + aSalTwoRect, + BMP_FORMAT_24BIT_TC_BGR, + 0); + + pSalRGB->ReleaseBuffer(pRGB, true); + pRGB = pExtraRGB; + } + + WinSalBitmap* pSalA = const_cast< WinSalBitmap* >(&rAlphaSource); + WinSalBitmap* pExtraWinSalA = 0; + + if(!pSalA->ImplGethDIB()) + { + // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap + pExtraWinSalA = new WinSalBitmap(); + pExtraWinSalA->Create(*pSalA, pSalA->GetBitCount()); + pSalA = pExtraWinSalA; + } + + BitmapBuffer* pA = pSalA->AcquireBuffer(true); + BitmapBuffer* pExtraA = 0; + + if(pA && BMP_FORMAT_8BIT_PAL != (pA->mnFormat & ~BMP_FORMAT_TOP_DOWN)) + { + // convert alpha bitmap to BMP_FORMAT_8BIT_PAL format if not yet in that format + SalTwoRect aSalTwoRect; + + aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0; + aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pA->mnWidth; + aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pA->mnHeight; + const BitmapPalette& rTargetPalette = Bitmap::GetGreyPalette(256); + + pExtraA = StretchAndConvert( + *pA, + aSalTwoRect, + BMP_FORMAT_8BIT_PAL, + &rTargetPalette); + + pSalA->ReleaseBuffer(pA, true); + pA = pExtraA; + } + + if(pRGB + && pA + && pRGB->mnWidth > 0 + && pRGB->mnHeight > 0 + && pRGB->mnWidth == pA->mnWidth + && pRGB->mnHeight == pA->mnHeight + && BMP_FORMAT_24BIT_TC_BGR == (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN) + && BMP_FORMAT_8BIT_PAL == (pA->mnFormat & ~BMP_FORMAT_TOP_DOWN)) + { + // we have alpha and bitmap in known formats, create GdiPlus Bitmap as 32bit ARGB + const sal_uInt32 nW(pRGB->mnWidth); + const sal_uInt32 nH(pRGB->mnHeight); + + pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat32bppARGB); + + if(pRetval) + { + sal_uInt8* pSrcRGB(pRGB->mpBits); + sal_uInt8* pSrcA(pA->mpBits); + const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); + const sal_uInt32 nExtraA(pA->mnScanlineSize - nW); + const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + + for(sal_uInt32 y(0); y < nH; y++) + { + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + + for(sal_uInt32 x(0); x < nW; x++) + { + const sal_uInt8 nB(*pSrcRGB++); + const sal_uInt8 nG(*pSrcRGB++); + const sal_uInt8 nR(*pSrcRGB++); + const sal_uInt8 nA(0xff - *pSrcA++); + + pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nA, nR, nG, nB)); + } + + pSrcRGB += nExtraRGB; + pSrcA += nExtraA; + } + } + } + + if(pExtraA) + { + delete pExtraA; + } + else + { + pSalA->ReleaseBuffer(pA, true); + } + + if(pExtraWinSalA) + { + delete pExtraWinSalA; + } + + if(pExtraRGB) + { + delete pExtraRGB; + } + else + { + pSalRGB->ReleaseBuffer(pRGB, true); + } + + if(pExtraWinSalRGB) + { + delete pExtraWinSalRGB; + } + + return pRetval; +} + +// ------------------------------------------------------------------ + bool WinSalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ) { bool bRet = TRUE; @@ -177,7 +594,7 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics ) { PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( rSalBmp.mhDIB ); PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI; - HDC hDC = pGraphics->mhDC; + HDC hDC = pGraphics->getHDC(); HBITMAP hNewDDB; BITMAP aDDBInfo; PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI + @@ -264,19 +681,6 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount ) // ------------------------------------------------------------------ -void WinSalBitmap::Destroy() -{ - if( mhDIB ) - GlobalFree( mhDIB ); - else if( mhDDB ) - DeleteObject( mhDDB ); - - maSize = Size(); - mnBitCount = 0; -} - -// ------------------------------------------------------------------ - sal_uInt16 WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) { sal_uInt16 nColors = 0; diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index e25a417a9179..9a05ce7ad91c 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -524,16 +524,16 @@ void ImplSalInitGraphics( WinSalGraphics* pData ) // Beim Printer berechnen wir die minimale Linienstaerke if ( pData->mbPrinter ) { - int nDPIX = GetDeviceCaps( pData->mhDC, LOGPIXELSX ); + int nDPIX = GetDeviceCaps( pData->getHDC(), LOGPIXELSX ); if ( nDPIX <= 300 ) pData->mnPenWidth = 0; else pData->mnPenWidth = nDPIX/300; } - ::SetTextAlign( pData->mhDC, TA_BASELINE | TA_LEFT | TA_NOUPDATECP ); - ::SetBkMode( pData->mhDC, TRANSPARENT ); - ::SetROP2( pData->mhDC, R2_COPYPEN ); + ::SetTextAlign( pData->getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP ); + ::SetBkMode( pData->getHDC(), TRANSPARENT ); + ::SetROP2( pData->getHDC(), R2_COPYPEN ); } // ----------------------------------------------------------------------- @@ -541,14 +541,14 @@ void ImplSalInitGraphics( WinSalGraphics* pData ) void ImplSalDeInitGraphics( WinSalGraphics* pData ) { // clear clip region - SelectClipRgn( pData->mhDC, 0 ); + SelectClipRgn( pData->getHDC(), 0 ); // select default objects if ( pData->mhDefPen ) - SelectPen( pData->mhDC, pData->mhDefPen ); + SelectPen( pData->getHDC(), pData->mhDefPen ); if ( pData->mhDefBrush ) - SelectBrush( pData->mhDC, pData->mhDefBrush ); + SelectBrush( pData->getHDC(), pData->mhDefBrush ); if ( pData->mhDefFont ) - SelectFont( pData->mhDC, pData->mhDefFont ); + SelectFont( pData->getHDC(), pData->mhDefFont ); } // ======================================================================= @@ -733,7 +733,7 @@ WinSalGraphics::WinSalGraphics() mfFontScale = 1.0; - mhDC = 0; + mhLocalDC = 0; mhPen = 0; mhBrush = 0; mhRegion = 0; @@ -795,8 +795,8 @@ WinSalGraphics::~WinSalGraphics() void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) { - rDPIX = GetDeviceCaps( mhDC, LOGPIXELSX ); - rDPIY = GetDeviceCaps( mhDC, LOGPIXELSY ); + rDPIX = GetDeviceCaps( getHDC(), LOGPIXELSX ); + rDPIY = GetDeviceCaps( getHDC(), LOGPIXELSY ); // #111139# this fixes the symptom of div by zero on startup // however, printing will fail most likely as communication with @@ -809,7 +809,7 @@ void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) sal_uInt16 WinSalGraphics::GetBitCount() { - return (sal_uInt16)GetDeviceCaps( mhDC, BITSPIXEL ); + return (sal_uInt16)GetDeviceCaps( getHDC(), BITSPIXEL ); } // ----------------------------------------------------------------------- @@ -846,7 +846,7 @@ void WinSalGraphics::ResetClipRegion() mhRegion = 0; } - SelectClipRgn( mhDC, 0 ); + SelectClipRgn( getHDC(), 0 ); } // ----------------------------------------------------------------------- @@ -1054,7 +1054,7 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } if( mhRegion ) - SelectClipRgn( mhDC, mhRegion ); + SelectClipRgn( getHDC(), mhRegion ); return mhRegion != 0; } @@ -1064,7 +1064,7 @@ void WinSalGraphics::SetLineColor() { // create and select new pen HPEN hNewPen = GetStockPen( NULL_PEN ); - HPEN hOldPen = SelectPen( mhDC, hNewPen ); + HPEN hOldPen = SelectPen( getHDC(), hNewPen ); // destory or save old pen if ( mhPen ) @@ -1122,7 +1122,7 @@ void WinSalGraphics::SetLineColor( SalColor nSalColor ) } // select new pen - HPEN hOldPen = SelectPen( mhDC, hNewPen ); + HPEN hOldPen = SelectPen( getHDC(), hNewPen ); // destory or save old pen if ( mhPen ) @@ -1146,7 +1146,7 @@ void WinSalGraphics::SetFillColor() { // create and select new brush HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH ); - HBRUSH hOldBrush = SelectBrush( mhDC, hNewBrush ); + HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush ); // destory or save old brush if ( mhBrush ) @@ -1250,7 +1250,7 @@ void WinSalGraphics::SetFillColor( SalColor nSalColor ) } // select new brush - HBRUSH hOldBrush = SelectBrush( mhDC, hNewBrush ); + HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush ); // destory or save old brush if ( mhBrush ) @@ -1273,7 +1273,7 @@ void WinSalGraphics::SetFillColor( SalColor nSalColor ) void WinSalGraphics::SetXORMode( bool bSet, bool ) { mbXORMode = bSet; - ::SetROP2( mhDC, bSet ? R2_XORPEN : R2_COPYPEN ); + ::SetROP2( getHDC(), bSet ? R2_XORPEN : R2_COPYPEN ); } // ----------------------------------------------------------------------- @@ -1297,13 +1297,13 @@ void WinSalGraphics::drawPixel( long nX, long nY ) if ( mbXORMode ) { HBRUSH hBrush = CreateSolidBrush( mnPenColor ); - HBRUSH hOldBrush = SelectBrush( mhDC, hBrush ); - PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT ); - SelectBrush( mhDC, hOldBrush ); + HBRUSH hOldBrush = SelectBrush( getHDC(), hBrush ); + PatBlt( getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT ); + SelectBrush( getHDC(), hOldBrush ); DeleteBrush( hBrush ); } else - SetPixel( mhDC, (int)nX, (int)nY, mnPenColor ); + SetPixel( getHDC(), (int)nX, (int)nY, mnPenColor ); } // ----------------------------------------------------------------------- @@ -1322,20 +1322,20 @@ void WinSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) if ( mbXORMode ) { HBRUSH hBrush = CreateSolidBrush( nCol ); - HBRUSH hOldBrush = SelectBrush( mhDC, hBrush ); - PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT ); - SelectBrush( mhDC, hOldBrush ); + HBRUSH hOldBrush = SelectBrush( getHDC(), hBrush ); + PatBlt( getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT ); + SelectBrush( getHDC(), hOldBrush ); DeleteBrush( hBrush ); } else - ::SetPixel( mhDC, (int)nX, (int)nY, nCol ); + ::SetPixel( getHDC(), (int)nX, (int)nY, nCol ); } // ----------------------------------------------------------------------- void WinSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) { - MoveToEx( mhDC, (int)nX1, (int)nY1, NULL ); + MoveToEx( getHDC(), (int)nX1, (int)nY1, NULL ); // we must paint the endpoint int bPaintEnd = TRUE; @@ -1356,20 +1356,20 @@ void WinSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) nX2--; } - LineTo( mhDC, (int)nX2, (int)nY2 ); + LineTo( getHDC(), (int)nX2, (int)nY2 ); if ( bPaintEnd && !mbPrinter ) { if ( mbXORMode ) { HBRUSH hBrush = CreateSolidBrush( mnPenColor ); - HBRUSH hOldBrush = SelectBrush( mhDC, hBrush ); - PatBlt( mhDC, (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT ); - SelectBrush( mhDC, hOldBrush ); + HBRUSH hOldBrush = SelectBrush( getHDC(), hBrush ); + PatBlt( getHDC(), (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT ); + SelectBrush( getHDC(), hOldBrush ); DeleteBrush( hBrush ); } else - SetPixel( mhDC, (int)nX2, (int)nY2, mnPenColor ); + SetPixel( getHDC(), (int)nX2, (int)nY2, mnPenColor ); } } @@ -1381,7 +1381,7 @@ void WinSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) { if ( !mbPrinter ) { - PatBlt( mhDC, (int)nX, (int)nY, (int)nWidth, (int)nHeight, + PatBlt( getHDC(), (int)nX, (int)nY, (int)nWidth, (int)nHeight, mbXORMode ? PATINVERT : PATCOPY ); } else @@ -1391,11 +1391,11 @@ void WinSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) aWinRect.top = nY; aWinRect.right = nX+nWidth; aWinRect.bottom = nY+nHeight; - ::FillRect( mhDC, &aWinRect, mhBrush ); + ::FillRect( getHDC(), &aWinRect, mhBrush ); } } else - WIN_Rectangle( mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); + WIN_Rectangle( getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); } // ----------------------------------------------------------------------- @@ -1409,8 +1409,8 @@ void WinSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ) POINT* pWinPtAry = (POINT*)pPtAry; // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl // von Punkten - if ( !Polyline( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) - Polyline( mhDC, pWinPtAry, MAX_64KSALPOINTS ); + if ( !Polyline( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + Polyline( getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } // ----------------------------------------------------------------------- @@ -1424,8 +1424,8 @@ void WinSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) POINT* pWinPtAry = (POINT*)pPtAry; // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl // von Punkten - if ( !WIN_Polygon( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) - WIN_Polygon( mhDC, pWinPtAry, MAX_64KSALPOINTS ); + if ( !WIN_Polygon( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + WIN_Polygon( getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } // ----------------------------------------------------------------------- @@ -1471,7 +1471,7 @@ void WinSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint n += nPoints; } - if ( !WIN_PolyPolygon( mhDC, pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) && + if ( !WIN_PolyPolygon( getHDC(), pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) && (nPolyPolyPoints > MAX_64KSALPOINTS) ) { nPolyPolyPoints = 0; @@ -1486,9 +1486,9 @@ void WinSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint if ( pWinPointAry[(UINT)nPoly] > MAX_64KSALPOINTS ) pWinPointAry[(UINT)nPoly] = MAX_64KSALPOINTS; if ( nPoly == 1 ) - WIN_Polygon( mhDC, pWinPointAryAry, *pWinPointAry ); + WIN_Polygon( getHDC(), pWinPointAryAry, *pWinPointAry ); else - WIN_PolyPolygon( mhDC, pWinPointAryAry, (int*)pWinPointAry, nPoly ); + WIN_PolyPolygon( getHDC(), pWinPointAryAry, (int*)pWinPointAry, nPoly ); } if ( pWinPointAry != aWinPointAry ) @@ -1510,7 +1510,7 @@ sal_Bool WinSalGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ), "WinSalGraphics::DrawPolyLineBezier(): POINT != SalPoint" ); - ImplRenderPath( mhDC, nPoints, pPtAry, pFlgAry ); + ImplRenderPath( getHDC(), nPoints, pPtAry, pFlgAry ); return sal_True; #else @@ -1546,13 +1546,13 @@ sal_Bool WinSalGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* p sal_Bool bRet( sal_False ); - if( BeginPath( mhDC ) ) + if( BeginPath( getHDC() ) ) { - PolyDraw(mhDC, pWinPointAry, pWinFlagAry, nPoints); + PolyDraw(getHDC(), pWinPointAry, pWinFlagAry, nPoints); - if( EndPath( mhDC ) ) + if( EndPath( getHDC() ) ) { - if( StrokeAndFillPath( mhDC ) ) + if( StrokeAndFillPath( getHDC() ) ) bRet = sal_True; } } @@ -1603,13 +1603,13 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt sal_Bool bRet( sal_False ); - if( BeginPath( mhDC ) ) + if( BeginPath( getHDC() ) ) { - PolyDraw(mhDC, pWinPointAry, pWinFlagAry, nTotalPoints); + PolyDraw(getHDC(), pWinPointAry, pWinFlagAry, nTotalPoints); - if( EndPath( mhDC ) ) + if( EndPath( getHDC() ) ) { - if( StrokeAndFillPath( mhDC ) ) + if( StrokeAndFillPath( getHDC() ) ) bRet = sal_True; } } @@ -1719,7 +1719,7 @@ sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, v { int nEscape = POSTSCRIPT_PASSTHROUGH; - if ( Escape( mhDC, QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) ) + if ( Escape( getHDC(), QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) ) { double nBoundingBox[4]; @@ -1806,7 +1806,7 @@ sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, v // #107797# Write out buffer // ---------------------------------------------------------------------------------- *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); - Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); + Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); // #107797# Write out EPS transformation code @@ -1826,7 +1826,7 @@ sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, v aBuf.append( "] concat\n" "%%BeginDocument:\n" ); *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); - Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); + Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); // #107797# Write out actual EPS content @@ -1842,7 +1842,7 @@ sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, v // of size POSTSCRIPT_BUFSIZE at construction time of aBuf *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)nDoNow; memcpy( (void*)(aBuf.getStr() + 2), (BYTE*)pPtr + nSize - nToDo, nDoNow ); - sal_uLong nResult = Escape ( mhDC, nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 ); + sal_uLong nResult = Escape ( getHDC(), nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 ); if (!nResult ) break; nToDo -= nResult; @@ -1858,7 +1858,7 @@ sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, v "countdictstack dict_count_salWin sub {end} repeat\n" "b4_Inc_state_salWin restore\n\n" ); *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); - Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); + Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); bRetValue = TRUE; } } @@ -1873,7 +1873,7 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const { SystemGraphicsData aRes; aRes.nSize = sizeof(aRes); - aRes.hDC = mhDC; + aRes.hDC = const_cast< WinSalGraphics* >(this)->getHDC(); return aRes; } diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index 9e40278368b1..5056458add56 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -59,42 +59,42 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const // ======================================================================= -void WinSalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) +void WinSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) { HDC hSrcDC; DWORD nRop; if ( pSrcGraphics ) - hSrcDC = static_cast<WinSalGraphics*>(pSrcGraphics)->mhDC; + hSrcDC = static_cast<WinSalGraphics*>(pSrcGraphics)->getHDC(); else - hSrcDC = mhDC; + hSrcDC = getHDC(); if ( mbXORMode ) nRop = SRCINVERT; else nRop = SRCCOPY; - if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) && - (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) ) + if ( (rPosAry.mnSrcWidth == rPosAry.mnDestWidth) && + (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) ) { - BitBlt( mhDC, - (int)pPosAry->mnDestX, (int)pPosAry->mnDestY, - (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight, + BitBlt( getHDC(), + (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, + (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, hSrcDC, - (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY, + (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, nRop ); } else { - int nOldStretchMode = SetStretchBltMode( mhDC, STRETCH_DELETESCANS ); - StretchBlt( mhDC, - (int)pPosAry->mnDestX, (int)pPosAry->mnDestY, - (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight, + int nOldStretchMode = SetStretchBltMode( getHDC(), STRETCH_DELETESCANS ); + StretchBlt( getHDC(), + (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, + (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, hSrcDC, - (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY, - (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight, + (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, + (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, nRop ); - SetStretchBltMode( mhDC, nOldStretchMode ); + SetStretchBltMode( getHDC(), nOldStretchMode ); } } @@ -285,19 +285,19 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, // we will prevent bitblt from copying useless data // epsecially now shadows from overlapping windows will appear (#i36344) hOldClipRgn = CreateRectRgn( 0, 0, 0, 0 ); - nOldClipRgnType = GetClipRgn( mhDC, hOldClipRgn ); + nOldClipRgnType = GetClipRgn( getHDC(), hOldClipRgn ); bRestoreClipRgn = TRUE; // indicate changed clipregion and force invalidate - ExtSelectClipRgn( mhDC, hInvalidateRgn, RGN_DIFF ); + ExtSelectClipRgn( getHDC(), hInvalidateRgn, RGN_DIFF ); } } } } - BitBlt( mhDC, + BitBlt( getHDC(), (int)nDestX, (int)nDestY, (int)nSrcWidth, (int)nSrcHeight, - mhDC, + getHDC(), (int)nSrcX, (int)nSrcY, SRCCOPY ); @@ -305,7 +305,7 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, { // restore old clip region if( nOldClipRgnType != ERROR ) - SelectClipRgn( mhDC, hOldClipRgn); + SelectClipRgn( getHDC(), hOldClipRgn); DeleteRegion( hOldClipRgn ); // invalidate regions that were not copied @@ -313,7 +313,7 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, // Combine Invalidate Region with existing ClipRegion HRGN hTempRgn = CreateRectRgn( 0, 0, 0, 0 ); - if ( GetClipRgn( mhDC, hTempRgn ) == 1 ) + if ( GetClipRgn( getHDC(), hTempRgn ) == 1 ) { int nRgnType = CombineRgn( hInvalidateRgn, hTempRgn, hInvalidateRgn, RGN_AND ); if ( (nRgnType == ERROR) || (nRgnType == NULLREGION) ) @@ -342,7 +342,7 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, // ----------------------------------------------------------------------- void ImplDrawBitmap( HDC hDC, - const SalTwoRect* pPosAry, const WinSalBitmap& rSalBitmap, + const SalTwoRect& rPosAry, const WinSalBitmap& rSalBitmap, sal_Bool bPrinter, int nDrawMode ) { if( hDC ) @@ -370,10 +370,10 @@ void ImplDrawBitmap( HDC hDC, const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS ); StretchDIBits( hDC, - (int)pPosAry->mnDestX, (int)pPosAry->mnDestY, - (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight, - (int)pPosAry->mnSrcX, (int)(pBIH->biHeight - pPosAry->mnSrcHeight - pPosAry->mnSrcY), - (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight, + (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, + (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, + (int)rPosAry.mnSrcX, (int)(pBIH->biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY), + (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, pBits, pBI, DIB_RGB_COLORS, nDrawMode ); GlobalUnlock( hDrawDIB ); @@ -392,14 +392,14 @@ void ImplDrawBitmap( HDC hDC, nOldTextColor = ::SetTextColor( hDC, RGB( 0x00, 0x00, 0x00 ) ); } - if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) && - (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) ) + if ( (rPosAry.mnSrcWidth == rPosAry.mnDestWidth) && + (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) ) { BitBlt( hDC, - (int)pPosAry->mnDestX, (int)pPosAry->mnDestY, - (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight, + (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, + (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, hBmpDC, - (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY, + (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, nDrawMode ); } else @@ -407,11 +407,11 @@ void ImplDrawBitmap( HDC hDC, const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS ); StretchBlt( hDC, - (int)pPosAry->mnDestX, (int)pPosAry->mnDestY, - (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight, + (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, + (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, hBmpDC, - (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY, - (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight, + (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, + (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, nDrawMode ); SetStretchBltMode( hDC, nOldStretchMode ); @@ -433,17 +433,36 @@ void ImplDrawBitmap( HDC hDC, // ----------------------------------------------------------------------- -void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap ) +void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) { - ImplDrawBitmap( mhDC, pPosAry, static_cast<const WinSalBitmap&>(rSalBitmap), - mbPrinter, - mbXORMode ? SRCINVERT : SRCCOPY ); + bool bTryDirectPaint(!mbPrinter && !mbXORMode); + + if(bTryDirectPaint) + { + // only paint direct when no scaling and no MapMode, else the + // more expensive conversions may be done for short-time Bitmap/BitmapEx + // used for buffering only + if(rPosAry.mnSrcWidth == rPosAry.mnDestWidth && rPosAry.mnSrcHeight == rPosAry.mnDestHeight) + { + bTryDirectPaint = false; + } + } + + // try to draw using GdiPlus directly + if(bTryDirectPaint && tryDrawBitmapGdiPlus(rPosAry, rSalBitmap)) + { + return; + } + + // fall back old stuff + ImplDrawBitmap(getHDC(), rPosAry, static_cast<const WinSalBitmap&>(rSalBitmap), + mbPrinter, + mbXORMode ? SRCINVERT : SRCCOPY ); } // ----------------------------------------------------------------------- -void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, +void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, SalColor nTransparentColor ) { @@ -492,28 +511,46 @@ void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, // hMaskBitmap is destroyed by new SalBitmap 'pMask' ( bDIB==FALSE, bCopy == FALSE ) if( pMask->Create( hMaskBitmap, FALSE, FALSE ) ) - drawBitmap( pPosAry, rSalBitmap, *pMask ); + drawBitmap( rPosAry, rSalBitmap, *pMask ); delete pMask; } // ----------------------------------------------------------------------- -void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, +void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, const SalBitmap& rSTransparentBitmap ) { DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); + bool bTryDirectPaint(!mbPrinter && !mbXORMode); + + if(bTryDirectPaint) + { + // only paint direct when no scaling and no MapMode, else the + // more expensive conversions may be done for short-time Bitmap/BitmapEx + // used for buffering only + if(rPosAry.mnSrcWidth == rPosAry.mnDestWidth && rPosAry.mnSrcHeight == rPosAry.mnDestHeight) + { + bTryDirectPaint = false; + } + } + + // try to draw using GdiPlus directly + if(bTryDirectPaint && drawAlphaBitmap(rPosAry, rSSalBitmap, rSTransparentBitmap)) + { + return; + } const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap); const WinSalBitmap& rTransparentBitmap = static_cast<const WinSalBitmap&>(rSTransparentBitmap); - SalTwoRect aPosAry = *pPosAry; + SalTwoRect aPosAry = rPosAry; int nDstX = (int)aPosAry.mnDestX; int nDstY = (int)aPosAry.mnDestY; int nDstWidth = (int)aPosAry.mnDestWidth; int nDstHeight = (int)aPosAry.mnDestHeight; - HDC hDC = mhDC; + HDC hDC = getHDC(); HBITMAP hMemBitmap = 0; HBITMAP hMaskBitmap = 0; @@ -537,17 +574,17 @@ void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, WinSalBitmap aTmp; if( aTmp.Create( rTransparentBitmap, this ) ) - ImplDrawBitmap( hMaskDC, &aPosAry, aTmp, FALSE, SRCCOPY ); + ImplDrawBitmap( hMaskDC, aPosAry, aTmp, FALSE, SRCCOPY ); } else - ImplDrawBitmap( hMaskDC, &aPosAry, rTransparentBitmap, FALSE, SRCCOPY ); + ImplDrawBitmap( hMaskDC, aPosAry, rTransparentBitmap, FALSE, SRCCOPY ); // now MemDC contains background, MaskDC the transparency mask // #105055# Respect XOR mode if( mbXORMode ) { - ImplDrawBitmap( hMaskDC, &aPosAry, rSalBitmap, FALSE, SRCERASE ); + ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE ); // now MaskDC contains the bitmap area with black background BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCINVERT ); // now MemDC contains background XORed bitmap area ontop @@ -556,7 +593,7 @@ void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, { BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCAND ); // now MemDC contains background with masked-out bitmap area - ImplDrawBitmap( hMaskDC, &aPosAry, rSalBitmap, FALSE, SRCERASE ); + ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE ); // now MaskDC contains the bitmap area with black background BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCPAINT ); // now MemDC contains background and bitmap merged together @@ -577,19 +614,6 @@ void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry, // ----------------------------------------------------------------------- -bool WinSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, - const SalBitmap& rSrcBitmap, - const SalBitmap& rAlphaBmp ) -{ - (void)rTR; (void)rSrcBitmap; (void)rAlphaBmp; - - // TODO(P3): implement alpha bmp blits. Catch: Windows only - // handles 32bpp, premultiplied bitmaps - return false; -} - -// ----------------------------------------------------------------------- - bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ) { @@ -608,7 +632,7 @@ bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, // hMemDC contains a 1x1 bitmap of the right color - stretch-blit // that to dest hdc - bool bRet = AlphaBlend( mhDC, nX, nY, nWidth, nHeight, + bool bRet = AlphaBlend( getHDC(), nX, nY, nWidth, nHeight, hMemDC, 0,0,1,1, aFunc ) == TRUE; @@ -619,7 +643,7 @@ bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, // ----------------------------------------------------------------------- -void WinSalGraphics::drawMask( const SalTwoRect* pPosAry, +void WinSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, SalColor nMaskColor ) { @@ -627,11 +651,11 @@ void WinSalGraphics::drawMask( const SalTwoRect* pPosAry, const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap); - SalTwoRect aPosAry = *pPosAry; + SalTwoRect aPosAry = rPosAry; const BYTE cRed = SALCOLOR_RED( nMaskColor ); const BYTE cGreen = SALCOLOR_GREEN( nMaskColor ); const BYTE cBlue = SALCOLOR_BLUE( nMaskColor ); - HDC hDC = mhDC; + HDC hDC = getHDC(); HBRUSH hMaskBrush = CreateSolidBrush( RGB( cRed, cGreen, cBlue ) ); HBRUSH hOldBrush = SelectBrush( hDC, hMaskBrush ); @@ -643,10 +667,10 @@ void WinSalGraphics::drawMask( const SalTwoRect* pPosAry, WinSalBitmap aTmp; if( aTmp.Create( rSalBitmap, this ) ) - ImplDrawBitmap( hDC, &aPosAry, aTmp, FALSE, 0x00B8074AUL ); + ImplDrawBitmap( hDC, aPosAry, aTmp, FALSE, 0x00B8074AUL ); } else - ImplDrawBitmap( hDC, &aPosAry, rSalBitmap, FALSE, 0x00B8074AUL ); + ImplDrawBitmap( hDC, aPosAry, rSalBitmap, FALSE, 0x00B8074AUL ); SelectBrush( hDC, hOldBrush ); DeleteBrush( hMaskBrush ); @@ -663,7 +687,7 @@ SalBitmap* WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) nDX = labs( nDX ); nDY = labs( nDY ); - HDC hDC = mhDC; + HDC hDC = getHDC(); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY ); HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap ); sal_Bool bRet; @@ -696,7 +720,7 @@ SalBitmap* WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) SalColor WinSalGraphics::getPixel( long nX, long nY ) { - COLORREF aWinCol = ::GetPixel( mhDC, (int) nX, (int) nY ); + COLORREF aWinCol = ::GetPixel( getHDC(), (int) nX, (int) nY ); if ( CLR_INVALID == aWinCol ) return MAKE_SALCOLOR( 0, 0, 0 ); @@ -713,15 +737,15 @@ void WinSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv if ( nFlags & SAL_INVERT_TRACKFRAME ) { HPEN hDotPen = CreatePen( PS_DOT, 0, 0 ); - HPEN hOldPen = SelectPen( mhDC, hDotPen ); - HBRUSH hOldBrush = SelectBrush( mhDC, GetStockBrush( NULL_BRUSH ) ); - int nOldROP = SetROP2( mhDC, R2_NOT ); + HPEN hOldPen = SelectPen( getHDC(), hDotPen ); + HBRUSH hOldBrush = SelectBrush( getHDC(), GetStockBrush( NULL_BRUSH ) ); + int nOldROP = SetROP2( getHDC(), R2_NOT ); - WIN_Rectangle( mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); + WIN_Rectangle( getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); - SetROP2( mhDC, nOldROP ); - SelectPen( mhDC, hOldPen ); - SelectBrush( mhDC, hOldBrush ); + SetROP2( getHDC(), nOldROP ); + SelectPen( getHDC(), hOldPen ); + SelectBrush( getHDC(), hOldBrush ); DeletePen( hDotPen ); } else if ( nFlags & SAL_INVERT_50 ) @@ -734,11 +758,11 @@ void WinSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp ); } - COLORREF nOldTextColor = ::SetTextColor( mhDC, 0 ); - HBRUSH hOldBrush = SelectBrush( mhDC, pSalData->mh50Brush ); - PatBlt( mhDC, nX, nY, nWidth, nHeight, PATINVERT ); - ::SetTextColor( mhDC, nOldTextColor ); - SelectBrush( mhDC, hOldBrush ); + COLORREF nOldTextColor = ::SetTextColor( getHDC(), 0 ); + HBRUSH hOldBrush = SelectBrush( getHDC(), pSalData->mh50Brush ); + PatBlt( getHDC(), nX, nY, nWidth, nHeight, PATINVERT ); + ::SetTextColor( getHDC(), nOldTextColor ); + SelectBrush( getHDC(), hOldBrush ); } else { @@ -747,7 +771,7 @@ void WinSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv aRect.top = (int)nY; aRect.right = (int)nX+nWidth; aRect.bottom = (int)nY+nHeight; - ::InvertRect( mhDC, &aRect ); + ::InvertRect( getHDC(), &aRect ); } } @@ -760,7 +784,7 @@ void WinSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver HBRUSH hBrush; HBRUSH hOldBrush = 0; COLORREF nOldTextColor RGB(0,0,0); - int nOldROP = SetROP2( mhDC, R2_NOT ); + int nOldROP = SetROP2( getHDC(), R2_NOT ); if ( nSalFlags & SAL_INVERT_TRACKFRAME ) hPen = CreatePen( PS_DOT, 0, 0 ); @@ -783,10 +807,10 @@ void WinSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver hBrush = GetStockBrush( BLACK_BRUSH ); hPen = GetStockPen( NULL_PEN ); - nOldTextColor = ::SetTextColor( mhDC, 0 ); - hOldBrush = SelectBrush( mhDC, hBrush ); + nOldTextColor = ::SetTextColor( getHDC(), 0 ); + hOldBrush = SelectBrush( getHDC(), hBrush ); } - hOldPen = SelectPen( mhDC, hPen ); + hOldPen = SelectPen( getHDC(), hPen ); POINT* pWinPtAry; // Unter NT koennen wir das Array direkt weiterreichen @@ -798,23 +822,23 @@ void WinSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver // von Punkten if ( nSalFlags & SAL_INVERT_TRACKFRAME ) { - if ( !Polyline( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) - Polyline( mhDC, pWinPtAry, MAX_64KSALPOINTS ); + if ( !Polyline( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + Polyline( getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } else { - if ( !WIN_Polygon( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) - WIN_Polygon( mhDC, pWinPtAry, MAX_64KSALPOINTS ); + if ( !WIN_Polygon( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + WIN_Polygon( getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } - SetROP2( mhDC, nOldROP ); - SelectPen( mhDC, hOldPen ); + SetROP2( getHDC(), nOldROP ); + SelectPen( getHDC(), hOldPen ); if ( nSalFlags & SAL_INVERT_TRACKFRAME ) DeletePen( hPen ); else { - ::SetTextColor( mhDC, nOldTextColor ); - SelectBrush( mhDC, hOldBrush ); + ::SetTextColor( getHDC(), nOldTextColor ); + SelectBrush( getHDC(), hOldBrush ); } } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 667166e0dc41..e2328c05d4d0 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1339,7 +1339,7 @@ void WinSalGraphics::SetTextColor( SalColor nSalColor ) aCol = PALRGB_TO_RGB( aCol ); } - ::SetTextColor( mhDC, aCol ); + ::SetTextColor( getHDC(), aCol ); } // ----------------------------------------------------------------------- @@ -1545,7 +1545,7 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont if( true/*aSalShlData.mbWNT*/ ) { LOGFONTW aLogFont; - ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); + ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true ); // on the display we prefer Courier New when Courier is a // bitmap only font and we need to stretch or rotate it @@ -1587,17 +1587,17 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" SelectFont( hdcScreen, SelectFont( hdcScreen , hNewFont ) ); } - o_rOldFont = ::SelectFont( mhDC, hNewFont ); + o_rOldFont = ::SelectFont( getHDC(), hNewFont ); TEXTMETRICW aTextMetricW; - if( !::GetTextMetricsW( mhDC, &aTextMetricW ) ) + if( !::GetTextMetricsW( getHDC(), &aTextMetricW ) ) { // the selected font doesn't work => try a replacement // TODO: use its font fallback instead lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); aLogFont.lfPitchAndFamily = FIXED_PITCH; HFONT hNewFont2 = CreateFontIndirectW( &aLogFont ); - SelectFont( mhDC, hNewFont2 ); + SelectFont( getHDC(), hNewFont2 ); DeleteFont( hNewFont ); hNewFont = hNewFont2; } @@ -1616,7 +1616,7 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve { // deselect still active font if( mhDefFont ) - ::SelectFont( mhDC, mhDefFont ); + ::SelectFont( getHDC(), mhDefFont ); // release no longer referenced font handles for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) { @@ -1657,7 +1657,7 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve mhFonts[ nFallbackLevel ] = hNewFont; // now the font is live => update font face if( mpWinFontData[ nFallbackLevel ] ) - mpWinFontData[ nFallbackLevel ]->UpdateFromHDC( mhDC ); + mpWinFontData[ nFallbackLevel ]->UpdateFromHDC( getHDC() ); if( !nFallbackLevel ) { @@ -1686,17 +1686,17 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel ) { // temporarily change the HDC to the font in the fallback level - HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] ); + HFONT hOldFont = SelectFont( getHDC(), mhFonts[nFallbackLevel] ); wchar_t aFaceName[LF_FACESIZE+60]; - if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) + if( ::GetTextFaceW( getHDC(), sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) pMetric->maName = reinterpret_cast<const sal_Unicode*>(aFaceName); // get the font metric TEXTMETRICA aWinMetric; - const bool bOK = GetTextMetricsA( mhDC, &aWinMetric ); + const bool bOK = GetTextMetricsA( getHDC(), &aWinMetric ); // restore the HDC to the font in the base level - SelectFont( mhDC, hOldFont ); + SelectFont( getHDC(), hOldFont ); if( !bOK ) return; @@ -1715,7 +1715,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe { // check if there are kern pairs // TODO: does this work with GPOS kerning? - DWORD nKernPairs = ::GetKerningPairsA( mhDC, 0, NULL ); + DWORD nKernPairs = ::GetKerningPairsA( getHDC(), 0, NULL ); pMetric->mbKernableFont = (nKernPairs > 0); } else @@ -1787,8 +1787,8 @@ static void ImplGetAllFontCharSets( WinSalGraphics* pData ) LOGFONTA aLogFont; memset( &aLogFont, 0, sizeof( aLogFont ) ); aLogFont.lfCharSet = DEFAULT_CHARSET; - GetTextFaceA( pData->mhDC, sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName ); - EnumFontFamiliesExA( pData->mhDC, &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA, + GetTextFaceA( pData->getHDC(), sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName ); + EnumFontFamiliesExA( pData->getHDC(), &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA, (LPARAM)(void*)pData, 0 ); } @@ -1796,12 +1796,12 @@ static void ImplGetAllFontCharSets( WinSalGraphics* pData ) static void ImplAddKerningPairs( WinSalGraphics* pData ) { - sal_uLong nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL ); + sal_uLong nPairs = ::GetKerningPairsA( pData->getHDC(), 0, NULL ); if ( !nPairs ) return; CHARSETINFO aInfo; - if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) ) + if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->getHDC() ), &aInfo, TCI_SRCCHARSET ) ) return; if ( !pData->mpFontKernPairs ) @@ -1818,7 +1818,7 @@ static void ImplAddKerningPairs( WinSalGraphics* pData ) UINT nCP = aInfo.ciACP; sal_uLong nOldPairs = pData->mnFontKernPairCount; KERNINGPAIR* pTempPair = pData->mpFontKernPairs+pData->mnFontKernPairCount; - nPairs = ::GetKerningPairsA( pData->mhDC, nPairs, pTempPair ); + nPairs = ::GetKerningPairsA( pData->getHDC(), nPairs, pTempPair ); for ( sal_uLong i = 0; i < nPairs; i++ ) { unsigned char aBuf[2]; @@ -1908,18 +1908,18 @@ sal_uLong WinSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKer mnFontKernPairCount = 0; KERNINGPAIR* pPairs = NULL; - int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); + int nCount = ::GetKerningPairsW( getHDC(), 0, NULL ); if( nCount ) { #ifdef GCP_KERN_HACK pPairs = new KERNINGPAIR[ nCount+1 ]; mpFontKernPairs = pPairs; mnFontKernPairCount = nCount; - ::GetKerningPairsW( mhDC, nCount, pPairs ); + ::GetKerningPairsW( getHDC(), nCount, pPairs ); #else // GCP_KERN_HACK pPairs = pKernPairs; nCount = (nCount < nPairs) : nCount : nPairs; - ::GetKerningPairsW( mhDC, nCount, pPairs ); + ::GetKerningPairsW( getHDC(), nCount, pPairs ); return nCount; #endif // GCP_KERN_HACK } @@ -2374,7 +2374,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) } ImplEnumInfo aInfo; - aInfo.mhDC = mhDC; + aInfo.mhDC = getHDC(); aInfo.mpList = pFontList; aInfo.mpName = NULL; aInfo.mpLogFontA = NULL; @@ -2403,7 +2403,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) memset( &aLogFont, 0, sizeof( aLogFont ) ); aLogFont.lfCharSet = DEFAULT_CHARSET; aInfo.mpLogFontW = &aLogFont; - EnumFontFamiliesExW( mhDC, &aLogFont, + EnumFontFamiliesExW( getHDC(), &aLogFont, (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 ); // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt, @@ -2415,7 +2415,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) } // set glyph fallback hook - static WinGlyphFallbackSubstititution aSubstFallback( mhDC ); + static WinGlyphFallbackSubstititution aSubstFallback( getHDC() ); pFontList->SetFallbackHook( &aSubstFallback ); } @@ -2428,7 +2428,7 @@ void WinSalGraphics::GetDevFontSubstList( OutputDevice* ) sal_Bool WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) { - HDC hDC = mhDC; + HDC hDC = getHDC(); // use unity matrix MAT2 aMat; @@ -2463,7 +2463,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, { rB2DPolyPoly.clear(); - HDC hDC = mhDC; + HDC hDC = getHDC(); // use unity matrix MAT2 aMat; @@ -2667,7 +2667,7 @@ ScopedFont::~ScopedFont() // restore original font, destroy temporary font HFONT hTempFont = m_rData.mhFonts[0]; m_rData.mhFonts[0] = m_hOrigFont; - SelectObject( m_rData.mhDC, m_hOrigFont ); + SelectObject( m_rData.getHDC(), m_hOrigFont ); DeleteObject( hTempFont ); } } @@ -2722,7 +2722,7 @@ sal_Bool WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, #if OSL_DEBUG_LEVEL > 1 // get font metrics TEXTMETRICA aWinMetric; - if( !::GetTextMetricsA( mhDC, &aWinMetric ) ) + if( !::GetTextMetricsA( getHDC(), &aWinMetric ) ) return FALSE; DBG_ASSERT( !(aWinMetric.tmPitchAndFamily & TMPF_DEVICE), "cannot subset device font" ); @@ -2737,10 +2737,10 @@ sal_Bool WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // check if the font has a CFF-table const DWORD nCffTag = CalcTag( "CFF " ); - const RawFontData aRawCffData( mhDC, nCffTag ); + const RawFontData aRawCffData( getHDC(), nCffTag ); if( aRawCffData.get() ) { - pWinFontData->UpdateFromHDC( mhDC ); + pWinFontData->UpdateFromHDC( getHDC() ); const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap(); pCharMap->AddReference(); @@ -2770,7 +2770,7 @@ sal_Bool WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, } // get raw font file data - const RawFontData xRawFontData( mhDC, NULL ); + const RawFontData xRawFontData( getHDC(), NULL ); if( !xRawFontData.get() ) return FALSE; @@ -2870,19 +2870,19 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, SetFont( &aIFSD, 0 ); // get the raw font file data - RawFontData aRawFontData( mhDC ); + RawFontData aRawFontData( getHDC() ); *pDataLen = aRawFontData.size(); if( !aRawFontData.get() ) return NULL; // get important font properties TEXTMETRICA aTm; - if( !::GetTextMetricsA( mhDC, &aTm ) ) + if( !::GetTextMetricsA( getHDC(), &aTm ) ) *pDataLen = 0; const bool bPFA = (*aRawFontData.get() < 0x80); rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; WCHAR aFaceName[64]; - int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName ); + int nFNLen = ::GetTextFaceW( getHDC(), 64, aFaceName ); // #i59854# strip eventual null byte while( nFNLen > 0 && aFaceName[nFNLen-1] == 0 ) nFNLen--; @@ -2900,7 +2900,7 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, { int nCharWidth = 0; const sal_Unicode cChar = pUnicodes[i]; - if( !::GetCharWidth32W( mhDC, cChar, cChar, &nCharWidth ) ) + if( !::GetCharWidth32W( getHDC(), cChar, cChar, &nCharWidth ) ) *pDataLen = 0; pCharWidths[i] = nCharWidth; } @@ -2941,7 +2941,7 @@ const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const ImplFontData* pF // TODO: get correct encoding vector GLYPHSET aGlyphSet; aGlyphSet.cbThis = sizeof(aGlyphSet); - DWORD aW = ::GetFontUnicodeRanges( mhDC, &aGlyphSet); + DWORD aW = ::GetFontUnicodeRanges( getHDC(), &aGlyphSet); #else for( sal_Unicode i = 32; i < 256; ++i ) (*pNewEncoding)[i] = i; @@ -2974,7 +2974,7 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, if( pFont->IsSubsettable() ) { // get raw font file data - const RawFontData xRawFontData( mhDC ); + const RawFontData xRawFontData( getHDC() ); if( !xRawFontData.get() ) return; @@ -3038,7 +3038,7 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, for( sal_Unicode i = 32; i < 256; ++i ) { int nCharWidth = 0; - if( ::GetCharWidth32W( mhDC, i, i, &nCharWidth ) ) + if( ::GetCharWidth32W( getHDC(), i, i, &nCharWidth ) ) { rUnicodeEnc[ i ] = rWidths.size(); rWidths.push_back( nCharWidth ); diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 6fc73b86d02c..9a0c8c4d7609 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -19,20 +19,17 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <stdio.h> #include <string.h> - #include <tools/svwin.h> #include <tools/debug.hxx> - #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salgdi.h> +#include <win/salbmp.h> #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -155,7 +152,7 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::Graphics aGraphics(getHDC()); const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); Gdiplus::SolidBrush aTestBrush(aTestColor); @@ -198,7 +195,7 @@ bool WinSalGraphics::drawPolyLine( if(mbPen && nCount) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::Graphics aGraphics(getHDC()); const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); @@ -287,3 +284,201 @@ bool WinSalGraphics::drawPolyLine( } // ----------------------------------------------------------------------- + +void paintToGdiPlus( + Gdiplus::Graphics& rGraphics, + const SalTwoRect& rTR, + Gdiplus::Bitmap& rBitmap) +{ + // only parts of source are used + Gdiplus::PointF aDestPoints[3]; + Gdiplus::ImageAttributes aAttributes; + + // define target region as paralellogram + aDestPoints[0].X = Gdiplus::REAL(rTR.mnDestX); + aDestPoints[0].Y = Gdiplus::REAL(rTR.mnDestY); + aDestPoints[1].X = Gdiplus::REAL(rTR.mnDestX + rTR.mnDestWidth); + aDestPoints[1].Y = Gdiplus::REAL(rTR.mnDestY); + aDestPoints[2].X = Gdiplus::REAL(rTR.mnDestX); + aDestPoints[2].Y = Gdiplus::REAL(rTR.mnDestY + rTR.mnDestHeight); + + aAttributes.SetWrapMode(Gdiplus::WrapModeTileFlipXY); + + rGraphics.DrawImage( + &rBitmap, + aDestPoints, + 3, + Gdiplus::REAL(rTR.mnSrcX), + Gdiplus::REAL(rTR.mnSrcY), + Gdiplus::REAL(rTR.mnSrcWidth), + Gdiplus::REAL(rTR.mnSrcHeight), + Gdiplus::UnitPixel, + &aAttributes, + 0, + 0); +} + +// ----------------------------------------------------------------------- + +void setInterpolationMode( + Gdiplus::Graphics& rGraphics, + const long& rSrcWidth, + const long& rDestWidth, + const long& rSrcHeight, + const long& rDestHeight) +{ + const bool bSameWidth(rSrcWidth == rDestWidth); + const bool bSameHeight(rSrcHeight == rDestHeight); + + if(bSameWidth && bSameHeight) + { + rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeInvalid); + } + else if(rDestWidth > rSrcWidth && rDestHeight > rSrcHeight) + { + rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeDefault); + } + else if(rDestWidth < rSrcWidth && rDestHeight < rSrcHeight) + { + rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeBicubic); + } + else + { + rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeDefault); + } +} + + +bool WinSalGraphics::tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap) +{ + if(rTR.mnSrcWidth && rTR.mnSrcHeight && rTR.mnDestWidth && rTR.mnDestHeight) + { + const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSrcBitmap); + GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap()); + + if(aARGB.get()) + { + Gdiplus::Graphics aGraphics(getHDC()); + + setInterpolationMode( + aGraphics, + rTR.mnSrcWidth, + rTR.mnDestWidth, + rTR.mnSrcHeight, + rTR.mnDestHeight); + + paintToGdiPlus( + aGraphics, + rTR, + *aARGB.get()); + + return true; + } + } + + return false; +} + +bool WinSalGraphics::drawAlphaBitmap( + const SalTwoRect& rTR, + const SalBitmap& rSrcBitmap, + const SalBitmap& rAlphaBmp) +{ + if(rTR.mnSrcWidth && rTR.mnSrcHeight && rTR.mnDestWidth && rTR.mnDestHeight) + { + const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSrcBitmap); + const WinSalBitmap& rSalAlpha = static_cast< const WinSalBitmap& >(rAlphaBmp); + GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap(&rSalAlpha)); + + if(aARGB.get()) + { + Gdiplus::Graphics aGraphics(getHDC()); + + setInterpolationMode( + aGraphics, + rTR.mnSrcWidth, + rTR.mnDestWidth, + rTR.mnSrcHeight, + rTR.mnDestHeight); + + paintToGdiPlus( + aGraphics, + rTR, + *aARGB.get()); + + return true; + } + } + + return false; +} + +// ----------------------------------------------------------------------- + +bool WinSalGraphics::drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap) +{ + const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSourceBitmap); + const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* >(pAlphaBitmap); + GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap(pSalAlpha)); + + if(aARGB.get()) + { + const long nSrcWidth(aARGB->GetWidth()); + const long nSrcHeight(aARGB->GetHeight()); + + if(nSrcWidth && nSrcHeight) + { + const long nDestWidth(basegfx::fround(basegfx::B2DVector(rX - rNull).getLength())); + const long nDestHeight(basegfx::fround(basegfx::B2DVector(rY - rNull).getLength())); + + if(nDestWidth && nDestHeight) + { + Gdiplus::Graphics aGraphics(getHDC()); + Gdiplus::PointF aDestPoints[3]; + Gdiplus::ImageAttributes aAttributes; + + setInterpolationMode( + aGraphics, + nSrcWidth, + nDestWidth, + nSrcHeight, + nDestHeight); + + // this mode is only capable of drawing the whole bitmap to a paralellogram + aDestPoints[0].X = Gdiplus::REAL(rNull.getX()); + aDestPoints[0].Y = Gdiplus::REAL(rNull.getY()); + aDestPoints[1].X = Gdiplus::REAL(rX.getX()); + aDestPoints[1].Y = Gdiplus::REAL(rX.getY()); + aDestPoints[2].X = Gdiplus::REAL(rY.getX()); + aDestPoints[2].Y = Gdiplus::REAL(rY.getY()); + + aAttributes.SetWrapMode(Gdiplus::WrapModeTileFlipXY); + + aGraphics.DrawImage( + aARGB.get(), + aDestPoints, + 3, + Gdiplus::REAL(0.0), + Gdiplus::REAL(0.0), + Gdiplus::REAL(nSrcWidth), + Gdiplus::REAL(nSrcHeight), + Gdiplus::UnitPixel, + &aAttributes, + 0, + 0); + } + } + + return true; + } + + return false; +} + +// ----------------------------------------------------------------------- +// eof diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index a8e63a404e23..c24fc763ecdf 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -1157,15 +1157,15 @@ sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, rc.bottom = buttonRect.Bottom()+1; // set default text alignment - int ta = SetTextAlign( mhDC, TA_LEFT|TA_TOP|TA_NOUPDATECP ); + int ta = SetTextAlign( getHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP ); OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics - bOk = ImplDrawNativeControl(mhDC, hTheme, rc, + bOk = ImplDrawNativeControl(getHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr ); // restore alignment - SetTextAlign( mhDC, ta ); + SetTextAlign( getHDC(), ta ); //GdiFlush(); diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index e2dae5fac0d7..79546dc1e402 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1444,7 +1444,7 @@ static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC ) { WinSalGraphics* pGraphics = new WinSalGraphics; pGraphics->SetLayout( 0 ); - pGraphics->mhDC = hDC; + pGraphics->setHDC(hDC); pGraphics->mhWnd = 0; pGraphics->mbPrinter = TRUE; pGraphics->mbVirDev = FALSE; @@ -1465,7 +1465,7 @@ static sal_Bool ImplUpdateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* p if ( pPrinter->mpGraphics ) { ImplSalDeInitGraphics( pPrinter->mpGraphics ); - DeleteDC( pPrinter->mpGraphics->mhDC ); + DeleteDC( pPrinter->mpGraphics->getHDC() ); delete pPrinter->mpGraphics; } @@ -1533,7 +1533,7 @@ WinSalInfoPrinter::~WinSalInfoPrinter() if ( mpGraphics ) { ImplSalDeInitGraphics( mpGraphics ); - DeleteDC( mpGraphics->mhDC ); + DeleteDC( mpGraphics->getHDC() ); delete mpGraphics; } } diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 0d4cce0be097..e0abdb4572db 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -94,11 +94,11 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, } else { - hDC = CreateCompatibleDC( pGraphics->mhDC ); + hDC = CreateCompatibleDC( pGraphics->getHDC() ); if( !hDC ) ImplWriteLastError( GetLastError(), "CreateCompatibleDC in CreateVirtualDevice" ); - hBmp = ImplCreateVirDevBitmap( pGraphics->mhDC, + hBmp = ImplCreateVirDevBitmap( pGraphics->getHDC(), nDX, nDY, nBitCount ); if( !hBmp ) ImplWriteLastError( GetLastError(), "ImplCreateVirDevBitmap in CreateVirtualDevice" ); @@ -117,7 +117,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, SalData* pSalData = GetSalData(); WinSalGraphics* pVirGraphics = new WinSalGraphics; pVirGraphics->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() - pVirGraphics->mhDC = hDC; + pVirGraphics->setHDC(hDC); pVirGraphics->mhWnd = 0; pVirGraphics->mbPrinter = FALSE; pVirGraphics->mbVirDev = TRUE; @@ -130,7 +130,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, } ImplSalInitGraphics( pVirGraphics ); - pVDev->mhDC = hDC; + pVDev->setHDC(hDC); pVDev->mhBmp = hBmp; if( hBmp ) pVDev->mhDefBmp = SelectBitmap( hDC, hBmp ); @@ -168,7 +168,7 @@ void WinSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) WinSalVirtualDevice::WinSalVirtualDevice() { - mhDC = (HDC) NULL; // HDC or 0 for Cache Device + setHDC((HDC)NULL); // HDC or 0 for Cache Device mhBmp = (HBITMAP) NULL; // Memory Bitmap mhDefBmp = (HBITMAP) NULL; // Default Bitmap mpGraphics = NULL; // current VirDev graphics @@ -191,12 +191,12 @@ WinSalVirtualDevice::~WinSalVirtualDevice() // destroy saved DC if( mpGraphics->mhDefPal ) - SelectPalette( mpGraphics->mhDC, mpGraphics->mhDefPal, TRUE ); + SelectPalette( mpGraphics->getHDC(), mpGraphics->mhDefPal, TRUE ); ImplSalDeInitGraphics( mpGraphics ); if( mhDefBmp ) - SelectBitmap( mpGraphics->mhDC, mhDefBmp ); + SelectBitmap( mpGraphics->getHDC(), mhDefBmp ); if( !mbForeignDC ) - DeleteDC( mpGraphics->mhDC ); + DeleteDC( mpGraphics->getHDC() ); if( mhBmp ) DeleteBitmap( mhBmp ); delete mpGraphics; @@ -231,11 +231,11 @@ sal_Bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) return TRUE; // ??? else { - HBITMAP hNewBmp = ImplCreateVirDevBitmap( mhDC, nDX, nDY, + HBITMAP hNewBmp = ImplCreateVirDevBitmap( getHDC(), nDX, nDY, mnBitCount ); if ( hNewBmp ) { - SelectBitmap( mhDC, hNewBmp ); + SelectBitmap( getHDC(), hNewBmp ); DeleteBitmap( mhBmp ); mhBmp = hNewBmp; return TRUE; @@ -250,6 +250,6 @@ sal_Bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) void WinSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) { - rWidth = GetDeviceCaps( mhDC, HORZRES ); - rHeight= GetDeviceCaps( mhDC, VERTRES ); + rWidth = GetDeviceCaps( getHDC(), HORZRES ); + rHeight= GetDeviceCaps( getHDC(), VERTRES ); } diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index eb8c88985dc4..ca4d0428208e 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -644,7 +644,7 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const return; WinSalGraphics& rWinGraphics = static_cast<WinSalGraphics&>(rGraphics); - HDC aHDC = rWinGraphics.mhDC; + HDC aHDC = rWinGraphics.getHDC(); HFONT hOrigFont = DisableFontScaling(); @@ -3021,7 +3021,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe else #endif // ENABLE_GRAPHITE // script complexity is determined in upper layers - pWinLayout = new UniscribeLayout( mhDC, rFontFace, rFontInstance ); + pWinLayout = new UniscribeLayout( getHDC(), rFontFace, rFontInstance ); // NOTE: it must be guaranteed that the WinSalGraphics lives longer than // the created UniscribeLayout, otherwise the data passed into the // constructor might become invalid too early @@ -3047,7 +3047,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe pWinLayout = new GraphiteWinLayout(mhDC, rFontFace, rFontInstance); else #endif // ENABLE_GRAPHITE - pWinLayout = new SimpleWinLayout( mhDC, eCharSet, rFontFace, rFontInstance ); + pWinLayout = new SimpleWinLayout( getHDC(), eCharSet, rFontFace, rFontInstance ); } if( mfFontScale != 1.0 ) @@ -3062,7 +3062,7 @@ int WinSalGraphics::GetMinKashidaWidth() { if( !mpWinFontEntry[0] ) return 0; - mpWinFontEntry[0]->InitKashidaHandling( mhDC ); + mpWinFontEntry[0]->InitKashidaHandling( getHDC() ); int nMinKashida = static_cast<int>(mfFontScale * mpWinFontEntry[0]->GetMinKashidaWidth()); return nMinKashida; } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index d2d76b1ad4c2..e0db2d123503 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -1053,16 +1053,16 @@ WinSalFrame::~WinSalFrame() // Release Cache DC if ( mpGraphics2 && - mpGraphics2->mhDC ) + mpGraphics2->getHDC() ) ReleaseGraphics( mpGraphics2 ); // destroy saved DC if ( mpGraphics ) { if ( mpGraphics->mhDefPal ) - SelectPalette( mpGraphics->mhDC, mpGraphics->mhDefPal, TRUE ); + SelectPalette( mpGraphics->getHDC(), mpGraphics->mhDefPal, TRUE ); ImplSalDeInitGraphics( mpGraphics ); - ReleaseDC( mhWnd, mpGraphics->mhDC ); + ReleaseDC( mhWnd, mpGraphics->getHDC() ); delete mpGraphics; mpGraphics = NULL; } @@ -1109,7 +1109,7 @@ SalGraphics* WinSalFrame::GetGraphics() if ( !mpGraphics2 ) { mpGraphics2 = new WinSalGraphics; - mpGraphics2->mhDC = 0; + mpGraphics2->setHDC(0); mpGraphics2->mhWnd = mhWnd; mpGraphics2->mbPrinter = FALSE; mpGraphics2->mbVirDev = FALSE; @@ -1122,7 +1122,7 @@ SalGraphics* WinSalFrame::GetGraphics() (WPARAM)mhWnd, 0 ); if ( hDC ) { - mpGraphics2->mhDC = hDC; + mpGraphics2->setHDC(hDC); if ( pSalData->mhDitherPal ) { mpGraphics2->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE ); @@ -1145,7 +1145,7 @@ SalGraphics* WinSalFrame::GetGraphics() if ( hDC ) { mpGraphics = new WinSalGraphics; - mpGraphics->mhDC = hDC; + mpGraphics->setHDC(hDC); mpGraphics->mhWnd = mhWnd; mpGraphics->mbPrinter = FALSE; mpGraphics->mbVirDev = FALSE; @@ -1173,17 +1173,17 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) { if ( mpGraphics2 == pGraphics ) { - if ( mpGraphics2->mhDC ) + if ( mpGraphics2->getHDC() ) { SalData* pSalData = GetSalData(); if ( mpGraphics2->mhDefPal ) - SelectPalette( mpGraphics2->mhDC, mpGraphics2->mhDefPal, TRUE ); + SelectPalette( mpGraphics2->getHDC(), mpGraphics2->mhDefPal, TRUE ); ImplSalDeInitGraphics( mpGraphics2 ); ImplSendMessage( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_RELEASEDC, (WPARAM)mhWnd, - (LPARAM)mpGraphics2->mhDC ); - mpGraphics2->mhDC = 0; + (LPARAM)mpGraphics2->getHDC() ); + mpGraphics2->setHDC(0); pSalData->mnCacheDCInUse--; } } @@ -1679,12 +1679,12 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, sal_Bool // Release Cache DC if ( pThis->mpGraphics2 && - pThis->mpGraphics2->mhDC ) + pThis->mpGraphics2->getHDC() ) { // save current gdi objects before hdc is gone - hFont = (HFONT) GetCurrentObject( pThis->mpGraphics2->mhDC, OBJ_FONT); - hPen = (HPEN) GetCurrentObject( pThis->mpGraphics2->mhDC, OBJ_PEN); - hBrush = (HBRUSH) GetCurrentObject( pThis->mpGraphics2->mhDC, OBJ_BRUSH); + hFont = (HFONT) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_FONT); + hPen = (HPEN) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_PEN); + hBrush = (HBRUSH) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_BRUSH); pThis->ReleaseGraphics( pThis->mpGraphics2 ); // recreate cache dc only if it was destroyed @@ -1695,9 +1695,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, sal_Bool if ( pThis->mpGraphics ) { if ( pThis->mpGraphics->mhDefPal ) - SelectPalette( pThis->mpGraphics->mhDC, pThis->mpGraphics->mhDefPal, TRUE ); + SelectPalette( pThis->mpGraphics->getHDC(), pThis->mpGraphics->mhDefPal, TRUE ); ImplSalDeInitGraphics( pThis->mpGraphics ); - ReleaseDC( pThis->mhWnd, pThis->mpGraphics->mhDC ); + ReleaseDC( pThis->mhWnd, pThis->mpGraphics->getHDC() ); } // create a new hwnd with the same styles @@ -1725,7 +1725,7 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, sal_Bool (WPARAM) hWnd, 0 ); if ( hDC ) { - pThis->mpGraphics2->mhDC = hDC; + pThis->mpGraphics2->setHDC(hDC); if ( pSalData->mhDitherPal ) { pThis->mpGraphics2->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE ); @@ -1754,11 +1754,11 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, sal_Bool { // re-create DC pThis->mpGraphics->mhWnd = hWnd; - pThis->mpGraphics->mhDC = GetDC( hWnd ); + pThis->mpGraphics->setHDC( GetDC( hWnd ) ); if ( GetSalData()->mhDitherPal ) { - pThis->mpGraphics->mhDefPal = SelectPalette( pThis->mpGraphics->mhDC, GetSalData()->mhDitherPal, TRUE ); - RealizePalette( pThis->mpGraphics->mhDC ); + pThis->mpGraphics->mhDefPal = SelectPalette( pThis->mpGraphics->getHDC(), GetSalData()->mhDitherPal, TRUE ); + RealizePalette( pThis->mpGraphics->getHDC() ); } ImplSalInitGraphics( pThis->mpGraphics ); pThis->mbGraphics = TRUE; @@ -3724,8 +3724,8 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg, // Wir restaurieren den Background-Modus bei jeder Texteingabe, // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen if ( pFrame->mpGraphics && - pFrame->mpGraphics->mhDC ) - SetBkMode( pFrame->mpGraphics->mhDC, TRANSPARENT ); + pFrame->mpGraphics->getHDC() ) + SetBkMode( pFrame->mpGraphics->getHDC(), TRANSPARENT ); // determine modifiers if ( GetKeyState( VK_SHIFT ) & 0x8000 ) @@ -4088,7 +4088,7 @@ static bool ImplHandlePaintMsg( HWND hWnd ) // Clip-Region muss zurueckgesetzt werden, da wir sonst kein // ordentliches Bounding-Rectangle bekommen if ( pFrame->mpGraphics && pFrame->mpGraphics->mhRegion ) - SelectClipRgn( pFrame->mpGraphics->mhDC, 0 ); + SelectClipRgn( pFrame->mpGraphics->getHDC(), 0 ); // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine // Paint-Region anliegt @@ -4105,7 +4105,7 @@ static bool ImplHandlePaintMsg( HWND hWnd ) // ClipRegion wieder herstellen if ( pFrame->mpGraphics && pFrame->mpGraphics->mhRegion ) { - SelectClipRgn( pFrame->mpGraphics->mhDC, + SelectClipRgn( pFrame->mpGraphics->getHDC(), pFrame->mpGraphics->mhRegion ); } @@ -4127,7 +4127,7 @@ static bool ImplHandlePaintMsg( HWND hWnd ) // ClipRegion wieder herstellen if ( pFrame->mpGraphics && pFrame->mpGraphics->mhRegion ) { - SelectClipRgn( pFrame->mpGraphics->mhDC, + SelectClipRgn( pFrame->mpGraphics->getHDC(), pFrame->mpGraphics->mhRegion ); } } @@ -4510,8 +4510,8 @@ static void ImplHandleForcePalette( HWND hWnd ) WinSalGraphics* pGraphics = pFrame->mpGraphics; if ( pGraphics && pGraphics->mhDefPal ) { - SelectPalette( pGraphics->mhDC, hPal, FALSE ); - if ( RealizePalette( pGraphics->mhDC ) ) + SelectPalette( pGraphics->getHDC(), hPal, FALSE ); + if ( RealizePalette( pGraphics->getHDC() ) ) { InvalidateRect( hWnd, NULL, FALSE ); UpdateWindow( hWnd ); @@ -4575,7 +4575,7 @@ static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, pGraphics = pTempVD->mpGraphics; if ( pGraphics->mhDefPal ) { - SelectPalette( pGraphics->mhDC, + SelectPalette( pGraphics->getHDC(), pGraphics->mhDefPal, TRUE ); } @@ -4587,7 +4587,7 @@ static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, pGraphics = pTempFrame->mpGraphics; if ( pGraphics && pGraphics->mhDefPal ) { - SelectPalette( pGraphics->mhDC, + SelectPalette( pGraphics->getHDC(), pGraphics->mhDefPal, TRUE ); } @@ -4600,7 +4600,7 @@ static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, pFrame = GetWindowPtr( hWnd ); if ( pFrame && pFrame->mpGraphics ) { - hDC = pFrame->mpGraphics->mhDC; + hDC = pFrame->mpGraphics->getHDC(); bStdDC = TRUE; } else @@ -4625,8 +4625,8 @@ static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, pGraphics = pTempVD->mpGraphics; if ( pGraphics->mhDefPal ) { - SelectPalette( pGraphics->mhDC, hPal, TRUE ); - RealizePalette( pGraphics->mhDC ); + SelectPalette( pGraphics->getHDC(), hPal, TRUE ); + RealizePalette( pGraphics->getHDC() ); } pTempVD = pTempVD->mpNext; } @@ -4638,8 +4638,8 @@ static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, pGraphics = pTempFrame->mpGraphics; if ( pGraphics && pGraphics->mhDefPal ) { - SelectPalette( pGraphics->mhDC, hPal, TRUE ); - if ( RealizePalette( pGraphics->mhDC ) ) + SelectPalette( pGraphics->getHDC(), hPal, TRUE ); + if ( RealizePalette( pGraphics->getHDC() ) ) bUpdate = TRUE; } } @@ -5520,8 +5520,8 @@ static sal_Bool ImplHandleIMEComposition( HWND hWnd, LPARAM lParam ) // Wir restaurieren den Background-Modus bei jeder Texteingabe, // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen if ( pFrame->mpGraphics && - pFrame->mpGraphics->mhDC ) - SetBkMode( pFrame->mpGraphics->mhDC, TRANSPARENT ); + pFrame->mpGraphics->getHDC() ) + SetBkMode( pFrame->mpGraphics->getHDC(), TRANSPARENT ); } if ( pFrame && pFrame->mbHandleIME ) |