summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2014-01-21 13:56:21 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2014-01-22 00:08:24 +0200
commit775da61892fa852c35ca6e2afe9a37620eaf14f7 (patch)
tree0dd5770e181c51f464d7f90b599e0925b479e598 /vcl
parente20439a1251de36efdd3dfe252b88f33cc94a0b7 (diff)
Make both GetTextBreak() use the same coding style
For easy visual comparison. Change-Id: Ib143f4bb7789b54dfbdd8fcf47516008403b47fd
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/outdev3.cxx75
1 files changed, 37 insertions, 38 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index f1d4b4955e7d..e2a4f384fd7e 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5989,7 +5989,6 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra ) const
{
-
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
sal_Int32 nRetVal = -1;
if( pSalLayout )
@@ -6021,55 +6020,55 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra ) const
{
-
rHyphenatorPos = -1;
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
- if( !pSalLayout )
- return -1;
-
- // convert logical widths into layout units
- // NOTE: be very careful to avoid rounding errors for nCharExtra case
- // problem with rounding errors especially for small nCharExtras
- // TODO: remove when layout units have subpixel granularity
- long nWidthFactor = pSalLayout->GetUnitsPerPixel();
- long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
-
- nTextWidth *= nWidthFactor * nSubPixelFactor;
- long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
- long nExtraPixelWidth = 0;
- if( nCharExtra != 0 )
+ sal_Int32 nRetVal = -1;
+ if( pSalLayout )
{
- nCharExtra *= nWidthFactor * nSubPixelFactor;
- nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
- }
+ // convert logical widths into layout units
+ // NOTE: be very careful to avoid rounding errors for nCharExtra case
+ // problem with rounding errors especially for small nCharExtras
+ // TODO: remove when layout units have subpixel granularity
+ long nWidthFactor = pSalLayout->GetUnitsPerPixel();
+ long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
- // calculate un-hyphenated break position
- sal_Int32 nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
+ nTextWidth *= nWidthFactor * nSubPixelFactor;
+ long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
+ long nExtraPixelWidth = 0;
+ if( nCharExtra != 0 )
+ {
+ nCharExtra *= nWidthFactor * nSubPixelFactor;
+ nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
+ }
- // calculate hyphenated break position
- OUString aHyphenatorStr(nHyphenatorChar);
- sal_Int32 nTempLen = 1;
- SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
- if( pHyphenatorLayout )
- {
- // calculate subpixel width of hyphenation character
- long nHyphenatorPixelWidth = pHyphenatorLayout->GetTextWidth() * nSubPixelFactor;
- pHyphenatorLayout->Release();
+ // calculate un-hyphenated break position
+ nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
// calculate hyphenated break position
- nTextPixelWidth -= nHyphenatorPixelWidth;
- if( nExtraPixelWidth > 0 )
- nTextPixelWidth -= nExtraPixelWidth;
+ OUString aHyphenatorStr(nHyphenatorChar);
+ sal_Int32 nTempLen = 1;
+ SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
+ if( pHyphenatorLayout )
+ {
+ // calculate subpixel width of hyphenation character
+ long nHyphenatorPixelWidth = pHyphenatorLayout->GetTextWidth() * nSubPixelFactor;
+ pHyphenatorLayout->Release();
- rHyphenatorPos =
- pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
+ // calculate hyphenated break position
+ nTextPixelWidth -= nHyphenatorPixelWidth;
+ if( nExtraPixelWidth > 0 )
+ nTextPixelWidth -= nExtraPixelWidth;
- if( rHyphenatorPos > nRetVal )
- rHyphenatorPos = nRetVal;
+ rHyphenatorPos = pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
+
+ if( rHyphenatorPos > nRetVal )
+ rHyphenatorPos = nRetVal;
+ }
+
+ pSalLayout->Release();
}
- pSalLayout->Release();
return nRetVal;
}