summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-07-19 00:00:03 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-07-20 22:11:00 +0200
commit6ca2d0d6645a697d323593a401ea8b1da02445bf (patch)
tree328c08bd305d11be87e7fdd63985645826992e3b /vcl/source
parentcd3d26b7edbce67805259a71e4118223e02ebdd4 (diff)
vcl use DeviceCoordinate got GetNextGlyphs
Change-Id: I0b03973b2d09a0ce51a6ee7dcca5a310a544c3a9
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx6
-rw-r--r--vcl/source/gdi/sallayout.cxx22
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx6
-rw-r--r--vcl/source/outdev/text.cxx28
-rw-r--r--vcl/source/outdev/textline.cxx12
5 files changed, 39 insertions, 35 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 718da4921cd5..2ff64f1daf24 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7416,7 +7416,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
aUnicodes.reserve( nMaxGlyphs );
sal_Int32 pUnicodesPerGlyph[nMaxGlyphs];
int pCharPosAry[nMaxGlyphs];
- long nAdvanceWidths[nMaxGlyphs];
+ DeviceCoordinate nAdvanceWidths[nMaxGlyphs];
const PhysicalFontFace* pFallbackFonts[nMaxGlyphs] = { NULL };
bool bVertical = m_aCurrentPDFState.m_aFont.IsVertical();
int nGlyphs;
@@ -7655,7 +7655,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
{
Point aPos, aStartPt;
sal_Int32 nWidth = 0;
- long nAdvance = 0;
+ DeviceCoordinate nAdvance = 0;
for( int nStart = 0;;)
{
sal_GlyphId aGlyphId;
@@ -7758,7 +7758,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
{
Point aPos;
sal_GlyphId aGlyphId;
- long nAdvance;
+ DeviceCoordinate nAdvance;
if( !rLayout.GetNextGlyphs( 1, &aGlyphId, aPos, nStart, &nAdvance ) )
break;
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 6724862a1e32..8faddc5271e3 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1298,7 +1298,7 @@ sal_Int32 GenericSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int n
}
int GenericSalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos,
- int& nStart, long* pGlyphAdvAry, int* pCharPosAry,
+ int& nStart, DeviceCoordinate* pGlyphAdvAry, int* pCharPosAry,
const PhysicalFontFace** /*pFallbackFonts*/ ) const
{
GlyphVector::const_iterator pG = m_GlyphItems.begin();
@@ -1607,7 +1607,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int nStartOld[ MAX_FALLBACK ];
int nStartNew[ MAX_FALLBACK ];
int nCharPos[ MAX_FALLBACK ];
- long nGlyphAdv[ MAX_FALLBACK ];
+ DeviceCoordinate nGlyphAdv[ MAX_FALLBACK ];
int nValid[ MAX_FALLBACK ] = {0};
sal_GlyphId nDummy;
@@ -1640,7 +1640,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nValid[ nLevel ] = mpLayouts[n]->GetNextGlyphs( 1, &nDummy, aPos,
nStartNew[ nLevel ], &nGlyphAdv[ nLevel ], &nCharPos[ nLevel ] );
#ifdef MULTI_SL_DEBUG
- if (nValid[nLevel]) fprintf(mslLog(), "layout[%d]->GetNextGlyphs %d,%d x%d a%d c%d %x\n", n, nStartOld[nLevel], nStartNew[nLevel], aPos.X(), nGlyphAdv[nLevel], nCharPos[nLevel],
+ if (nValid[nLevel]) fprintf(mslLog(), "layout[%d]->GetNextGlyphs %d,%d x%d a%d c%d %x\n", n, nStartOld[nLevel], nStartNew[nLevel], aPos.X(), (long)nGlyphAdv[nLevel], nCharPos[nLevel],
rArgs.mpStr[nCharPos[nLevel]]);
#endif
if( (n > 0) && !nValid[ nLevel ] )
@@ -1710,7 +1710,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nValid[0] = mpLayouts[0]->GetNextGlyphs( 1, &nDummy, aPos,
nStartNew[0], &nGlyphAdv[0], &nCharPos[0] );
#ifdef MULTI_SL_DEBUG
- if (nValid[0]) fprintf(mslLog(), "layout[0]->GetNextGlyphs %d,%d x%d a%d c%d %x\n", nStartOld[0], nStartNew[0], aPos.X(), nGlyphAdv[0], nCharPos[0], rArgs.mpStr[nCharPos[0]]);
+ if (nValid[0]) fprintf(mslLog(), "layout[0]->GetNextGlyphs %d,%d x%d a%d c%d %x\n", nStartOld[0], nStartNew[0], aPos.X(), (long)nGlyphAdv[0], nCharPos[0], rArgs.mpStr[nCharPos[0]]);
#endif
if( !nValid[0] )
break;
@@ -1718,7 +1718,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
// skip to end of layout run and calculate its advance width
- int nRunAdvance = 0;
+ DeviceCoordinate nRunAdvance = 0;
bool bKeepNotDef = (nFBLevel >= nLevel);
for(;;)
{
@@ -1728,9 +1728,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nStartOld[n] = nStartNew[n];
int nOrigCharPos = nCharPos[n];
nValid[n] = mpLayouts[n]->GetNextGlyphs( 1, &nDummy, aPos,
- nStartNew[n], &nGlyphAdv[n], &nCharPos[n] );
+ nStartNew[n], &nGlyphAdv[n], &nCharPos[n] );
#ifdef MULTI_SL_DEBUG
- if (nValid[n]) fprintf(mslLog(), "layout[%d]->GetNextGlyphs %d,%d a%d c%d %x\n", n, nStartOld[n], nStartNew[n], nGlyphAdv[n], nCharPos[n], rArgs.mpStr[nCharPos[n]]);
+ if (nValid[n]) fprintf(mslLog(), "layout[%d]->GetNextGlyphs %d,%d a%d c%d %x\n", n, nStartOld[n], nStartNew[n], (long)nGlyphAdv[n], nCharPos[n], rArgs.mpStr[nCharPos[n]]);
#endif
// break after last glyph of active layout
if( !nValid[n] )
@@ -2015,7 +2015,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) cons
}
int MultiSalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos,
- int& nStart, long* pGlyphAdvAry, int* pCharPosAry,
+ int& nStart, DeviceCoordinate* pGlyphAdvAry, int* pCharPosAry,
const PhysicalFontFace** pFallbackFonts ) const
{
// for multi-level fallback only single glyphs should be used
@@ -2041,8 +2041,8 @@ int MultiSalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& r
{
if( pGlyphAdvAry )
{
- long w = pGlyphAdvAry[i];
- w = static_cast<long>(w * fUnitMul + 0.5);
+ DeviceCoordinate w = pGlyphAdvAry[i];
+ w = static_cast<DeviceCoordinate>(w * fUnitMul + 0.5);
pGlyphAdvAry[i] = w;
}
pGlyphIdxAry[ i ] |= nFontTag;
@@ -2063,7 +2063,7 @@ int MultiSalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& r
}
bool MultiSalLayout::GetOutline( SalGraphics& rGraphics,
- ::basegfx::B2DPolyPolygonVector& rPPV ) const
+ ::basegfx::B2DPolyPolygonVector& rPPV ) const
{
bool bRet = false;
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index f04b5ec93c46..e5cb5a700e03 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -1212,8 +1212,8 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, long* pCaretXArray ) con
// The logic in this method must match that expected in MultiSalLayout which
// is used when glyph fallback is in operation.
int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
- ::Point & aPosOut, int &glyph_slot, sal_Int32 * glyph_adv, int *char_index,
- const PhysicalFontFace** /*pFallbackFonts*/ ) const
+ ::Point & aPosOut, int &glyph_slot, DeviceCoordinate* glyph_adv, int *char_index,
+ const PhysicalFontFace** /*pFallbackFonts*/ ) const
{
// Sanity check on the slot index.
if (glyph_slot >= signed(mvGlyphs.size()))
@@ -1277,7 +1277,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
#ifdef GRLAYOUT_DEBUG
fprintf(grLog(),"GetNextGlyphs g%d gid%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n",
glyph_slot - 1, glyph_itr->maGlyphId,
- mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
+ mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), (long)nGlyphAdvance,
aPosOut.X(), aPosOut.Y());
#endif
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1cffe587912b..00cf4e6b2db4 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1330,7 +1330,7 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
DeviceCoordinate* pDXPixelArray = NULL;
if( nLogicalWidth && mbMap )
{
- nPixelWidth = ImplLogicWidthToDevicePixel( nLogicalWidth );
+ nPixelWidth = LogicWidthToDeviceCoordinate( nLogicalWidth );
}
if( pDXArray)
@@ -1340,9 +1340,11 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
// 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() );
+ DeviceCoordinate nPixelXOfs = LogicWidthToDeviceCoordinate( rLogicalPos.X() );
for( int i = 0; i < nLen; ++i )
- pDXPixelArray[i] = ImplLogicWidthToDevicePixel( rLogicalPos.X() + pDXArray[i] ) - nPixelXOfs;
+ {
+ pDXPixelArray[i] = LogicWidthToDeviceCoordinate( rLogicalPos.X() + pDXArray[i] ) - nPixelXOfs;
+ }
}
else
{
@@ -1422,12 +1424,12 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
long nWidthFactor = pSalLayout->GetUnitsPerPixel();
long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
nTextWidth *= nWidthFactor * nSubPixelFactor;
- long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
- long nExtraPixelWidth = 0;
+ DeviceCoordinate nTextPixelWidth = LogicWidthToDeviceCoordinate( nTextWidth );
+ DeviceCoordinate nExtraPixelWidth = 0;
if( nCharExtra != 0 )
{
nCharExtra *= nWidthFactor * nSubPixelFactor;
- nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
+ nExtraPixelWidth = LogicWidthToDeviceCoordinate( nCharExtra );
}
nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
@@ -1456,12 +1458,12 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
nTextWidth *= nWidthFactor * nSubPixelFactor;
- long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
- long nExtraPixelWidth = 0;
+ DeviceCoordinate nTextPixelWidth = LogicWidthToDeviceCoordinate( nTextWidth );
+ DeviceCoordinate nExtraPixelWidth = 0;
if( nCharExtra != 0 )
{
nCharExtra *= nWidthFactor * nSubPixelFactor;
- nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
+ nExtraPixelWidth = LogicWidthToDeviceCoordinate( nCharExtra );
}
// calculate un-hyphenated break position
@@ -1646,14 +1648,14 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r
{
long nMnemonicX;
long nMnemonicY;
- long nMnemonicWidth;
+ DeviceCoordinate nMnemonicWidth;
long* pCaretXArray = (long*) alloca( 2 * sizeof(long) * nLineLen );
/*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray,
nIndex, nLineLen );
long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)];
long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1];
- nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) );
+ nMnemonicWidth = rTargetDevice.LogicWidthToDeviceCoordinate( ::abs((long)(lc_x1 - lc_x2)) );
Point aTempPos = rTargetDevice.LogicToPixel( aPos );
nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( std::min( lc_x1, lc_x2 ) );
@@ -1714,14 +1716,14 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r
long nMnemonicX = 0;
long nMnemonicY = 0;
- long nMnemonicWidth = 0;
+ DeviceCoordinate nMnemonicWidth = 0;
if ( nMnemonicPos != -1 )
{
long* pCaretXArray = (long*) alloca( 2 * sizeof(long) * aStr.getLength() );
/*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.getLength() );
long lc_x1 = pCaretXArray[2*(nMnemonicPos)];
long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1];
- nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) );
+ nMnemonicWidth = rTargetDevice.LogicWidthToDeviceCoordinate( ::abs((long)(lc_x1 - lc_x2)) );
Point aTempPos = rTargetDevice.LogicToPixel( aPos );
nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( std::min(lc_x1, lc_x2) );
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 5acd59f4c3e9..4e0add03d7e5 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -668,7 +668,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
}
void OutputDevice::ImplDrawTextLine( long nX, long nY,
- long nDistX, long nWidth,
+ long nDistX, DeviceCoordinate nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
FontUnderline eOverline,
@@ -745,8 +745,9 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
// calculate distance of each word from the base point
Point aPos;
- sal_Int32 nDist = 0, nWidth = 0;
- long nAdvance = 0;
+ DeviceCoordinate nDist = 0;
+ DeviceCoordinate nWidth = 0;
+ DeviceCoordinate nAdvance = 0;
for( int nStart = 0;;)
{
// iterate through the layouted glyphs
@@ -964,9 +965,10 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
InitFont();
Point aPos = ImplLogicToDevicePixel( rPos );
- nWidth = ImplLogicWidthToDevicePixel( nWidth );
+ DeviceCoordinate fWidth;
+ fWidth = LogicWidthToDeviceCoordinate( nWidth );
aPos += Point( mnTextOffX, mnTextOffY );
- ImplDrawTextLine( aPos.X(), aPos.X(), 0, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
+ ImplDrawTextLine( aPos.X(), aPos.X(), 0, fWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
if( mpAlphaVDev )
mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );