summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-07-17 18:46:08 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-07-20 22:10:58 +0200
commit2b8528a2745bec7909bfe2265d6110a9964eef47 (patch)
tree335279159b6f01de07ea23e15679e566ac000ed5 /vcl
parent269e960ee190a8f568e99756c90cd98f1a7919ce (diff)
Use DeviceCorrdinate for DXArray in FillDXArray and ImplLayoutArgs
Change-Id: Ifba7104a13cf737200c81d1a1bd5ece9a29da60e
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/graphite_layout.hxx2
-rw-r--r--vcl/inc/graphite_serverfont.hxx19
-rw-r--r--vcl/inc/sallayout.hxx17
-rw-r--r--vcl/quartz/ctlayout.cxx6
-rw-r--r--vcl/source/gdi/sallayout.cxx46
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx4
-rw-r--r--vcl/source/outdev/text.cxx100
-rw-r--r--vcl/win/source/gdi/winlayout.cxx12
8 files changed, 142 insertions, 64 deletions
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 6a84d54647fb..feb341d76b86 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -124,7 +124,7 @@ public:
// methods using string indexing
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
- virtual long FillDXArray( sal_Int32* pDXArray ) const SAL_OVERRIDE;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
virtual void ApplyDXArray(ImplLayoutArgs &rArgs, std::vector<int> & rDeltaWidth);
virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const SAL_OVERRIDE;
diff --git a/vcl/inc/graphite_serverfont.hxx b/vcl/inc/graphite_serverfont.hxx
index 180ed69236d9..b4540e20d600 100644
--- a/vcl/inc/graphite_serverfont.hxx
+++ b/vcl/inc/graphite_serverfont.hxx
@@ -68,11 +68,22 @@ public:
maImpl.DrawOffset() = maDrawOffset;
maImpl.AdjustLayout(rArgs);
};
- virtual long GetTextWidth() const SAL_OVERRIDE { return maImpl.GetTextWidth(); }
- virtual long FillDXArray( sal_Int32* dxa ) const SAL_OVERRIDE { return maImpl.FillDXArray(dxa); }
+ virtual long GetTextWidth() const SAL_OVERRIDE
+ {
+ return maImpl.GetTextWidth();
+ }
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* dxa ) const SAL_OVERRIDE
+ {
+ return maImpl.FillDXArray(dxa);
+ }
virtual sal_Int32 GetTextBreak(long mw, long ce, int f) const SAL_OVERRIDE
- { return maImpl.GetTextBreak(mw, ce, f); }
- virtual void GetCaretPositions( int as, sal_Int32* cxa ) const SAL_OVERRIDE { maImpl.GetCaretPositions(as, cxa); }
+ {
+ return maImpl.GetTextBreak(mw, ce, f);
+ }
+ virtual void GetCaretPositions( int as, sal_Int32* cxa ) const SAL_OVERRIDE
+ {
+ maImpl.GetCaretPositions(as, cxa);
+ }
// used by display layers
virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index d191a38417cf..c69b42b0bfb4 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -29,6 +29,7 @@
#include <tools/gen.hxx>
#include <vcl/dllapi.h>
#include <vcl/vclenum.hxx> // for typedef sal_UCS4
+#include <vcl/devicecoordinate.hxx>
#ifndef _TOOLS_LANG_HXX
typedef unsigned short LanguageType;
@@ -76,8 +77,8 @@ public:
const sal_Unicode* mpStr;
// positioning related inputs
- const sal_Int32* mpDXArray; // in pixel units
- long mnLayoutWidth; // in pixel units
+ const DeviceCoordinate* mpDXArray; // in pixel units
+ DeviceCoordinate mnLayoutWidth; // in pixel units
int mnOrientation; // in 0-3600 system
// data for bidi and glyph+script fallback
@@ -89,8 +90,8 @@ public:
int nMinCharPos, int nEndCharPos, int nFlags,
const LanguageTag& rLanguageTag );
- void SetLayoutWidth( long nWidth ) { mnLayoutWidth = nWidth; }
- void SetDXArray( const sal_Int32* pDXArray ) { mpDXArray = pDXArray; }
+ void SetLayoutWidth( DeviceCoordinate nWidth ) { mnLayoutWidth = nWidth; }
+ void SetDXArray( const DeviceCoordinate* pDXArray ) { mpDXArray = pDXArray; }
void SetOrientation( int nOrientation ) { mnOrientation = nOrientation; }
void ResetPos()
@@ -171,7 +172,7 @@ public:
// methods using string indexing
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const = 0;
- virtual long FillDXArray( sal_Int32* pDXArray ) const = 0;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const = 0;
virtual long GetTextWidth() const { return FillDXArray( NULL ); }
virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0;
virtual bool IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594
@@ -229,7 +230,7 @@ class VCL_PLUGIN_PUBLIC MultiSalLayout : public SalLayout
public:
virtual void DrawText( SalGraphics& ) const SAL_OVERRIDE;
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
- virtual long FillDXArray( sal_Int32* pDXArray ) const SAL_OVERRIDE;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const SAL_OVERRIDE;
virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos,
int&, sal_Int32* pGlyphAdvAry, int* pCharPosAry,
@@ -329,7 +330,7 @@ public:
// used by upper layers
virtual long GetTextWidth() const SAL_OVERRIDE;
- virtual long FillDXArray( sal_Int32* pDXArray ) const SAL_OVERRIDE;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const SAL_OVERRIDE;
@@ -347,7 +348,7 @@ protected:
virtual void DropGlyph( int nStart ) SAL_OVERRIDE;
virtual void Simplify( bool bIsBase ) SAL_OVERRIDE;
- bool GetCharWidths( sal_Int32* pCharWidths ) const;
+ bool GetCharWidths( DeviceCoordinate* pCharWidths ) const;
GlyphVector m_GlyphItems;
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index ea6d406bddef..b21d8607a470 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -43,7 +43,7 @@ public:
const PhysicalFontFace** pFallbackFonts ) const SAL_OVERRIDE;
virtual long GetTextWidth() const SAL_OVERRIDE;
- virtual long FillDXArray( sal_Int32* pDXArray ) const SAL_OVERRIDE;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const SAL_OVERRIDE;
virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const SAL_OVERRIDE;
@@ -587,9 +587,9 @@ long CTLayout::GetTextWidth() const
return lrint(GetWidth());
}
-long CTLayout::FillDXArray( sal_Int32* pDXArray ) const
+DeviceCoordinate CTLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
{
- long nPixWidth = GetTextWidth();
+ DeviceCoordinate nPixWidth = GetWidth();
// short circuit requests which don't need full details
if( !pDXArray )
return nPixWidth;
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 20a0ff656e31..100352082631 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -836,7 +836,7 @@ void GenericSalLayout::AppendGlyph( const GlyphItem& rGlyphItem )
m_GlyphItems.push_back(rGlyphItem);
}
-bool GenericSalLayout::GetCharWidths( sal_Int32* pCharWidths ) const
+bool GenericSalLayout::GetCharWidths( DeviceCoordinate* pCharWidths ) const
{
// initialize character extents buffer
int nCharCount = mnEndCharPos - mnMinCharPos;
@@ -910,7 +910,7 @@ bool GenericSalLayout::GetCharWidths( sal_Int32* pCharWidths ) const
return true;
}
-long GenericSalLayout::FillDXArray( sal_Int32* pCharWidths ) const
+DeviceCoordinate GenericSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) const
{
if( pCharWidths )
if( !GetCharWidths( pCharWidths ) )
@@ -1281,7 +1281,7 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray
sal_Int32 GenericSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const
{
int nCharCapacity = mnEndCharPos - mnMinCharPos;
- sal_Int32* pCharWidths = (sal_Int32*)alloca( nCharCapacity * sizeof(sal_Int32) );
+ DeviceCoordinate* pCharWidths = (DeviceCoordinate*)alloca( nCharCapacity * sizeof(DeviceCoordinate) );
if( !GetCharWidths( pCharWidths ) )
return -1;
@@ -1528,7 +1528,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
// for stretched text in a MultiSalLayout the target width needs to be
// distributed by individually adjusting its virtual character widths
- long nTargetWidth = aMultiArgs.mnLayoutWidth;
+ DeviceCoordinate nTargetWidth = aMultiArgs.mnLayoutWidth;
nTargetWidth *= mnUnitsPerPixel; // convert target width to base font units
aMultiArgs.mnLayoutWidth = 0;
@@ -1537,12 +1537,12 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
mpLayouts[n]->SalLayout::AdjustLayout( aMultiArgs );
// then we can measure the unmodified metrics
int nCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
- sal_Int32* pJustificationArray = (sal_Int32*)alloca( nCharCount * sizeof(sal_Int32) );
+ DeviceCoordinate* pJustificationArray = (DeviceCoordinate*)alloca( nCharCount * sizeof(sal_Int32) );
FillDXArray( pJustificationArray );
// #i17359# multilayout is not simplified yet, so calculating the
// unjustified width needs handholding; also count the number of
// stretchable virtual char widths
- long nOrigWidth = 0;
+ DeviceCoordinate nOrigWidth = 0;
int nStretchable = 0;
for( int i = 0; i < nCharCount; ++i )
{
@@ -1555,14 +1555,14 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
// now we are able to distribute the extra width over the virtual char widths
if( nOrigWidth && (nTargetWidth != nOrigWidth) )
{
- int nDiffWidth = nTargetWidth - nOrigWidth;
- int nWidthSum = 0;
+ DeviceCoordinate nDiffWidth = nTargetWidth - nOrigWidth;
+ DeviceCoordinate nWidthSum = 0;
for( int i = 0; i < nCharCount; ++i )
{
- int nJustWidth = pJustificationArray[i];
+ DeviceCoordinate nJustWidth = pJustificationArray[i];
if( (nJustWidth > 0) && (nStretchable > 0) )
{
- int nDeltaWidth = nDiffWidth / nStretchable;
+ DeviceCoordinate nDeltaWidth = nDiffWidth / nStretchable;
nJustWidth += nDeltaWidth;
nDiffWidth -= nDeltaWidth;
--nStretchable;
@@ -1579,7 +1579,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
for( int i = 0; i < nCharCount; ++i )
{
- sal_Int32 nVal = pJustificationArray[ i ];
+ DeviceCoordinate nVal = pJustificationArray[ i ];
nVal += (mnUnitsPerPixel + 1) / 2;
pJustificationArray[ i ] = nVal / mnUnitsPerPixel;
}
@@ -1915,7 +1915,7 @@ sal_Int32 MultiSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFa
return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor );
int nCharCount = mnEndCharPos - mnMinCharPos;
- sal_Int32* pCharWidths = (sal_Int32*)alloca( 2*nCharCount * sizeof(sal_Int32) );
+ DeviceCoordinate* pCharWidths = (DeviceCoordinate*)alloca( 2*nCharCount * sizeof(DeviceCoordinate) );
mpLayouts[0]->FillDXArray( pCharWidths );
for( int n = 1; n < mnLevel; ++n )
@@ -1926,13 +1926,13 @@ sal_Int32 MultiSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFa
fUnitMul /= rLayout.GetUnitsPerPixel();
for( int i = 0; i < nCharCount; ++i )
{
- long w = pCharWidths[ i + nCharCount ];
- w = static_cast<long>(w*fUnitMul + 0.5);
+ DeviceCoordinate w = pCharWidths[ i + nCharCount ];
+ w = (DeviceCoordinate)(w * fUnitMul + 0.5);
pCharWidths[ i ] += w;
}
}
- long nWidth = 0;
+ DeviceCoordinate nWidth = 0;
for( int i = 0; i < nCharCount; ++i )
{
nWidth += pCharWidths[ i ] * nFactor;
@@ -1944,30 +1944,30 @@ sal_Int32 MultiSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFa
return -1;
}
-long MultiSalLayout::FillDXArray( sal_Int32* pCharWidths ) const
+DeviceCoordinate MultiSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) const
{
- long nMaxWidth = 0;
+ DeviceCoordinate nMaxWidth = 0;
// prepare merging of fallback levels
- sal_Int32* pTempWidths = NULL;
+ DeviceCoordinate* pTempWidths = NULL;
const int nCharCount = mnEndCharPos - mnMinCharPos;
if( pCharWidths )
{
for( int i = 0; i < nCharCount; ++i )
pCharWidths[i] = 0;
- pTempWidths = (sal_Int32*)alloca( nCharCount * sizeof(sal_Int32) );
+ pTempWidths = (DeviceCoordinate*)alloca( nCharCount * sizeof(DeviceCoordinate) );
}
for( int n = mnLevel; --n >= 0; )
{
// query every fallback level
- long nTextWidth = mpLayouts[n]->FillDXArray( pTempWidths );
+ DeviceCoordinate nTextWidth = mpLayouts[n]->FillDXArray( pTempWidths );
if( !nTextWidth )
continue;
// merge results from current level
double fUnitMul = mnUnitsPerPixel;
fUnitMul /= mpLayouts[n]->GetUnitsPerPixel();
- nTextWidth = static_cast<long>(nTextWidth * fUnitMul + 0.5);
+ nTextWidth = (DeviceCoordinate)(nTextWidth * fUnitMul + 0.5);
if( nMaxWidth < nTextWidth )
nMaxWidth = nTextWidth;
if( !pCharWidths )
@@ -1979,10 +1979,10 @@ long MultiSalLayout::FillDXArray( sal_Int32* pCharWidths ) const
// one char cannot be resolved from different fallbacks
if( pCharWidths[i] != 0 )
continue;
- long nCharWidth = pTempWidths[i];
+ DeviceCoordinate nCharWidth = pTempWidths[i];
if( !nCharWidth )
continue;
- nCharWidth = static_cast<long>(nCharWidth * fUnitMul + 0.5);
+ nCharWidth = (DeviceCoordinate)(nCharWidth * fUnitMul + 0.5);
pCharWidths[i] = nCharWidth;
}
}
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 57e61ffe60c3..d9801102787f 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -732,7 +732,7 @@ sal_Int32 GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int fac
return nBreak;
}
-long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
+DeviceCoordinate GraphiteLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
{
if (mnEndCharPos == mnMinCharPos)
// Then we must be zero width!
@@ -766,7 +766,7 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
//fprintf(grLog(),"FillDX %ld,%d\n", mnWidth, std::accumulate(pDXArray, pDXArray + mvCharDxs.size(), 0));
}
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"FillDXArray %d-%d=%ld\n", mnMinCharPos, mnEndCharPos, mnWidth);
+ fprintf(grLog(),"FillDXArray %d-%d=%g\n", mnMinCharPos, mnEndCharPos, (double)mnWidth);
#endif
return mnWidth;
}
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 93a0e919d2a2..f9669e0f402e 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1004,6 +1004,56 @@ long OutputDevice::GetTextArray( const OUString& rStr, sal_Int32* pDXAry,
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
if( !pSalLayout )
return 0;
+#if VCL_FLOAT_DEVICE_PIXEL
+ DeviceCoordinate* pDXPixelArray = NULL;
+ if(pDXAry)
+ {
+ pDXPixelArray = (DeviceCoordinate*)alloca(nLen * sizeof(DeviceCoordinate));
+ }
+ DeviceCoordinate nWidth = pSalLayout->FillDXArray( pDXPixelArray );
+ int nWidthFactor = pSalLayout->GetUnitsPerPixel();
+ pSalLayout->Release();
+
+ // convert virtual char widths to virtual absolute positions
+ if( pDXPixelArray )
+ {
+ for( int i = 1; i < nLen; ++i )
+ {
+ pDXPixelArray[ i ] += pDXPixelArray[ i-1 ];
+ }
+ }
+ if( mbMap )
+ {
+ if( pDXPixelArray )
+ {
+ for( int i = 0; i < nLen; ++i )
+ {
+ pDXPixelArray[i] = ImplDevicePixelToLogicWidth( pDXPixelArray[i] );
+ }
+ }
+ nWidth = ImplDevicePixelToLogicWidth( nWidth );
+ }
+ if( nWidthFactor > 1 )
+ {
+ if( pDXPixelArray )
+ {
+ for( int i = 0; i < nLen; ++i )
+ {
+ pDXPixelArray[i] /= nWidthFactor;
+ }
+ }
+ nWidth /= nWidthFactor;
+ }
+ if(pDXAry)
+ {
+ for( int i = 0; i < nLen; ++i )
+ {
+ pDXAry[i] = basegfx::fround(pDXPixelArray[i]);
+ }
+ }
+ return basegfx::fround(nWidth);
+
+#else /* ! VCL_FLOAT_DEVICE_PIXEL */
long nWidth = pSalLayout->FillDXArray( pDXAry );
int nWidthFactor = pSalLayout->GetUnitsPerPixel();
@@ -1030,8 +1080,8 @@ long OutputDevice::GetTextArray( const OUString& rStr, sal_Int32* pDXAry,
pDXAry[i] /= nWidthFactor;
nWidth /= nWidthFactor;
}
-
return nWidth;
+#endif /* VCL_FLOAT_DEVICE_PIXEL */
}
bool OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXArray,
@@ -1132,7 +1182,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
const sal_Int32 nMinIndex, const sal_Int32 nLen,
- long nPixelWidth, const sal_Int32* pDXArray,
+ DeviceCoordinate nPixelWidth, const DeviceCoordinate* pDXArray,
int nLayoutFlags ) const
{
assert(nMinIndex >= 0);
@@ -1276,23 +1326,39 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
if( mpFontEntry->mpConversion ) {
mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.getLength() );
}
-
- long nPixelWidth = nLogicalWidth;
+ DeviceCoordinate nPixelWidth = (DeviceCoordinate)nLogicalWidth;
+ DeviceCoordinate* pDXPixelArray = NULL;
if( nLogicalWidth && mbMap )
- nPixelWidth = ImplLogicWidthToDevicePixel( nLogicalWidth );
- if( pDXArray && mbMap )
{
- // convert from logical units to font units using a temporary array
- sal_Int32* pTempDXAry = (sal_Int32*)alloca( nLen * sizeof(sal_Int32) );
- // using base position for better rounding a.k.a. "dancing characters"
- int nPixelXOfs = ImplLogicWidthToDevicePixel( rLogicalPos.X() );
- for( int i = 0; i < nLen; ++i )
- pTempDXAry[i] = ImplLogicWidthToDevicePixel( rLogicalPos.X() + pDXArray[i] ) - nPixelXOfs;
+ nPixelWidth = ImplLogicWidthToDevicePixel( nLogicalWidth );
+ }
- pDXArray = pTempDXAry;
+ if( pDXArray)
+ {
+ if(mbMap)
+ {
+ // convert from logical units to font units using a temporary array
+ pDXPixelArray = (DeviceCoordinate*)alloca( nLen * sizeof(DeviceCoordinate) );
+ // using base position for better rounding a.k.a. "dancing characters"
+ DeviceCoordinate nPixelXOfs = ImplLogicWidthToDevicePixel( rLogicalPos.X() );
+ for( int i = 0; i < nLen; ++i )
+ pDXPixelArray[i] = ImplLogicWidthToDevicePixel( rLogicalPos.X() + pDXArray[i] ) - nPixelXOfs;
+ }
+ else
+ {
+#if VCL_FLOAT_DEVICE_PIXEL
+ pDXPixelArray = (DeviceCoordinate*)alloca( nLen * sizeof(DeviceCoordinate) );
+ for( int i = 0; i < nLen; ++i )
+ {
+ pDXPixelArray[i] = pDXArray[i];
+ }
+#else /* !VCL_FLOAT_DEVICE_PIXEL */
+ pDXPixelArray = (DeviceCoordinate*)pDXArray;
+#endif /* !VCL_FLOAT_DEVICE_PIXEL */
+ }
}
- ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXArray, flags);
+ ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXPixelArray, flags);
// get matching layout object for base font
SalLayout* pSalLayout = mpGraphics->GetTextLayout( aLayoutArgs, 0 );
@@ -1318,9 +1384,9 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
// adjust to right alignment if necessary
if( aLayoutArgs.mnFlags & SAL_LAYOUT_RIGHT_ALIGN )
{
- long nRTLOffset;
- if( pDXArray )
- nRTLOffset = pDXArray[ nLen - 1 ];
+ DeviceCoordinate nRTLOffset;
+ if( pDXPixelArray )
+ nRTLOffset = pDXPixelArray[ nLen - 1 ];
else if( nPixelWidth )
nRTLOffset = nPixelWidth;
else
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index fe51de257884..d6adc874a514 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -145,7 +145,7 @@ public:
sal_Int32* pGlyphAdvances, int* pCharIndexes,
const PhysicalFontFace** pFallbackFonts = NULL ) const;
- virtual long FillDXArray( long* pDXArray ) const;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
@@ -626,7 +626,7 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const
DeleteFont( SelectFont( aHDC, hOrigFont ) );
}
-long SimpleWinLayout::FillDXArray( long* pDXArray ) const
+DeviceCoordinate SimpleWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
{
if( !mnWidth )
{
@@ -966,7 +966,7 @@ public:
sal_Int32* pGlyphAdvances, int* pCharPosAry,
const PhysicalFontFace** pFallbackFonts = NULL ) const;
- virtual long FillDXArray( long* pDXArray ) const;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
virtual bool IsKashidaPosValid ( int nCharPos ) const;
@@ -2086,7 +2086,7 @@ void UniscribeLayout::DrawText( SalGraphics& ) const
DeleteFont( SelectFont( mhDC, hOrigFont ) );
}
-long UniscribeLayout::FillDXArray( long* pDXArray ) const
+DeviceCoordinate UniscribeLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
{
// calculate width of the complete layout
long nWidth = mnBaseAdv;
@@ -2641,7 +2641,7 @@ public:
// methods using string indexing
virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
- virtual long FillDXArray( long* pDXArray ) const;
+ virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
@@ -2783,7 +2783,7 @@ sal_Int32 GraphiteWinLayout::GetTextBreak(
return nBreak;
}
-long GraphiteWinLayout::FillDXArray( long* pDXArray ) const
+DeviceCoordinate GraphiteWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
{
return maImpl.FillDXArray(pDXArray);
}