diff options
Diffstat (limited to 'vcl/win/source')
-rw-r--r-- | vcl/win/source/app/salinst.cxx | 2 | ||||
-rw-r--r-- | vcl/win/source/app/saltimer.cxx | 2 | ||||
-rw-r--r-- | vcl/win/source/gdi/salbmp.cxx | 94 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi.cxx | 10 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi2.cxx | 4 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 6 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 17 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 12 |
8 files changed, 85 insertions, 62 deletions
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 55ab108967b9..7b1b3b2fae12 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -771,7 +771,7 @@ LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar rDef = FALSE; break; // If we get this message, because another GetMessage() call - // has recieved this message, we must post this message to + // has received this message, we must post this message to // us again, because in the other case we wait forever. case SAL_MSG_RELEASEWAITYIELD: { diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index 0a967b52cf1e..4ed3f2b3910b 100644 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -117,7 +117,7 @@ void CALLBACK SalTimerProc( HWND, UINT, UINT_PTR nId, DWORD ) bool bRecursive = pSalData->mbInTimerProc && (nId != SALTIMERPROC_RECURSIVE); if ( pSVData->mpSalTimer && ! bRecursive ) { - // Try to aquire the mutex. If we don't get the mutex then we + // Try to acquire the mutex. If we don't get the mutex then we // try this a short time later again. if ( ImplSalYieldMutexTryToAcquire() ) { diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 005f822e4599..f4578edd25d0 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -310,24 +310,32 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap() if(pRetval) { - sal_uInt8* pSrcRGB(pRGB->mpBits); - const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); - const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); - const Gdiplus::Rect aAllRect(0, 0, nW, nH); - Gdiplus::BitmapData aGdiPlusBitmapData; - pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData); - - // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible - for(sal_uInt32 y(0); y < nH; y++) + if ( pRetval->GetLastStatus() == Gdiplus::Ok ) { - const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); - sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); + sal_uInt8* pSrcRGB(pRGB->mpBits); + const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); + const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData); + + // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible + for(sal_uInt32 y(0); y < nH; y++) + { + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - memcpy(targetPixels, pSrcRGB, nW * 3); - pSrcRGB += nW * 3 + nExtraRGB; - } + memcpy(targetPixels, pSrcRGB, nW * 3); + pSrcRGB += nW * 3 + nExtraRGB; + } - pRetval->UnlockBits(&aGdiPlusBitmapData); + pRetval->UnlockBits(&aGdiPlusBitmapData); + } + else + { + delete pRetval; + pRetval = NULL; + } } } @@ -440,35 +448,43 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph 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); - const Gdiplus::Rect aAllRect(0, 0, nW, nH); - Gdiplus::BitmapData aGdiPlusBitmapData; - pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData); - - // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and - // A from alpha, so inner loop is needed (who invented BitmapEx..?) - for(sal_uInt32 y(0); y < nH; y++) + if ( pRetval->GetLastStatus() == Gdiplus::Ok ) // 2nd place to secure with new Gdiplus::Bitmap { - const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); - sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - - for(sal_uInt32 x(0); x < nW; x++) + 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); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData); + + // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and + // A from alpha, so inner loop is needed (who invented BitmapEx..?) + for(sal_uInt32 y(0); y < nH; y++) { - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = 0xff - *pSrcA++; + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); + + for(sal_uInt32 x(0); x < nW; x++) + { + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = 0xff - *pSrcA++; + } + + pSrcRGB += nExtraRGB; + pSrcA += nExtraA; } - pSrcRGB += nExtraRGB; - pSrcA += nExtraA; + pRetval->UnlockBits(&aGdiPlusBitmapData); + } + else + { + delete pRetval; + pRetval = NULL; } - - pRetval->UnlockBits(&aGdiPlusBitmapData); } } diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 276dfca00a62..ecf972e03a6c 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -354,7 +354,7 @@ void ImplFreeSalGDI() pSalData->mhDitherPal = 0; } - // delete buffers for dithering DIB patterns, if neccessary + // delete buffers for dithering DIB patterns, if necessary if ( pSalData->mhDitherDIB ) { GlobalUnlock( pSalData->mhDitherDIB ); @@ -1087,7 +1087,7 @@ void WinSalGraphics::SetLineColor() HPEN hNewPen = GetStockPen( NULL_PEN ); HPEN hOldPen = SelectPen( getHDC(), hNewPen ); - // destory or save old pen + // destroy or save old pen if ( mhPen ) { if ( !mbStockPen ) @@ -1145,7 +1145,7 @@ void WinSalGraphics::SetLineColor( SalColor nSalColor ) // select new pen HPEN hOldPen = SelectPen( getHDC(), hNewPen ); - // destory or save old pen + // destroy or save old pen if ( mhPen ) { if ( !mbStockPen ) @@ -1169,7 +1169,7 @@ void WinSalGraphics::SetFillColor() HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH ); HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush ); - // destory or save old brush + // destroy or save old brush if ( mhBrush ) { if ( !mbStockBrush ) @@ -1273,7 +1273,7 @@ void WinSalGraphics::SetFillColor( SalColor nSalColor ) // select new brush HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush ); - // destory or save old brush + // destroy or save old brush if ( mhBrush ) { if ( !mbStockBrush ) diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index e8273baabc10..c61c5a6ce2ab 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -270,7 +270,7 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, { // hInvalidateRgn contains the fully visible parts of the original srcRect hTempRgn = CreateRectRgnIndirect( &aSrcRect ); - // substract it from the original rect to get the occluded parts + // subtract it from the original rect to get the occluded parts nRgnType = CombineRgn( hInvalidateRgn, hTempRgn, hInvalidateRgn, RGN_DIFF ); DeleteRegion( hTempRgn ); @@ -709,7 +709,7 @@ SalBitmap* WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) else { err = GetLastError(); - // #124826# avoid resource leak ! happens when runing without desktop access (remote desktop, service, may be screensavers) + // #124826# avoid resource leak ! happens when running without desktop access (remote desktop, service, may be screensavers) DeleteBitmap( hBmpBitmap ); } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index da67ab35fb70..e4cd2bafabde 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -406,7 +406,7 @@ static Unicode2LangType aLangFromCodeChart[]= { // get language matching to the missing char LanguageType MapCharToLanguage( sal_UCS4 uChar ) { - // entries marked with default-CJK get replaced with the prefered CJK language + // entries marked with default-CJK get replaced with the preferred CJK language static bool bFirst = true; if( bFirst ) { @@ -450,7 +450,7 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar ) break; } - // change the marked entries to prefered language + // change the marked entries to preferred language static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)); for( int i = 0; i < nCount; ++i ) { @@ -547,7 +547,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, } // find a fallback font for missing characters -// TODO: should stylistic matches be searched and prefered? +// TODO: should stylistic matches be searched and preferred? bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const { // guess a locale matching to the missing chars diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 7fab9292f41b..51db718e72e2 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -415,12 +415,19 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) bool bSurrogate = ((nCharCode >= 0xD800) && (nCharCode <= 0xDFFF)); if( bSurrogate ) { - if( nCharCode >= 0xDC00 ) // this part of a surrogate pair was already processed + // ignore high surrogates, they were already processed with their low surrogates + if( nCharCode >= 0xDC00 ) continue; - nCharCode = 0x10000 + ((pCodes[0] - 0xD800) << 10) + (pCodes[1] - 0xDC00); - } + // check the second half of the surrogate pair + bSurrogate &= (0xDC00 <= pCodes[1]) && (pCodes[1] <= 0xDFFF); + // calculate the UTF-32 code of valid surrogate pairs + if( bSurrogate ) + nCharCode = 0x10000 + ((pCodes[0] - 0xD800) << 10) + (pCodes[1] - 0xDC00); + else // or fall back to a replacement character + nCharCode = '?'; + } - // get the advance width for the current UCS-4 code point + // get the advance width for the current UTF-32 code point int nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode ); if( nGlyphWidth == -1 ) { @@ -438,7 +445,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) mpGlyphAdvances[ i ] = nGlyphWidth; mnWidth += nGlyphWidth; - // remaining codes of surrogate pair get a zero width + // the second half of surrogate pair gets a zero width if( bSurrogate && ((i+1) < mnGlyphCount) ) mpGlyphAdvances[ i+1 ] = 0; diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 86ef843ac779..5eef35c1f2a5 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -1582,7 +1582,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, aRect.bottom = pt.y+2; // dualmonitor support: - // Get screensize of the monitor whith the mouse pointer + // Get screensize of the monitor with the mouse pointer ImplSalGetWorkArea( mhWnd, &aRect, &aRect ); nX = ((aRect.right-aRect.left)-nWidth)/2 + aRect.left; @@ -4177,7 +4177,7 @@ static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pPa // calculate and set frame geometry of a maximized window - useful if the window is still hidden // dualmonitor support: - // Get screensize of the monitor whith the mouse pointer + // Get screensize of the monitor with the mouse pointer RECT aRectMouse; if( ! pParentRect ) @@ -4841,7 +4841,7 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam ) if( nFound == 1 ) nRet = MAKELRESULT( idxFound, MNC_EXECUTE ); else - // duplicate mnemonics, just select the next occurence + // duplicate mnemonics, just select the next occurrence nRet = MAKELRESULT( idxFound, MNC_SELECT ); return nRet; @@ -5111,7 +5111,7 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam ) long nRet = 0; if ( hMenu && !pFrame->mLastActivatedhMenu ) { - // we never activated a menu (ie, no WM_INITMENUPOPUP has occured yet) + // we never activated a menu (ie, no WM_INITMENUPOPUP has occurred yet) // which means this must be the menubar -> send activation/deactivation SalMenuEvent aMenuEvt; WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( hMenu, nId, bByPosition ); @@ -6208,10 +6208,10 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP if (Application::GetSettings().GetMiscSettings().GetEnableATToolSupport()) { - // Make sure to launch Accessibiliity only the following criterias are satisfied to avoid RFT interrupts regular acc processing + // Make sure to launch Accessibiliity only the following criteria are satisfied to avoid RFT interrupts regular acc processing if (g_acc_manager1 == NULL) { - sal_Bool bCancelled; + sal_Bool bCancelled(sal_False); InitAccessBridge(sal_False,bCancelled); if( bCancelled ) break; |