diff options
author | Noel Grandin <noel@peralex.com> | 2020-11-12 12:29:08 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-14 20:43:07 +0100 |
commit | 0f04b8204a77ecaee7d9ebe6868808445c8b138a (patch) | |
tree | 92da7b71ed889bde2595cc0bff3a82f429aa14c7 /vcl/source | |
parent | 4ad0459494303745b377c848c681a747f294fc64 (diff) |
remove SalPoint
<caolan> that "SalPoint" doesn't really seem to to have a purpose
except to highlight that "Point" is assumed to use LONG under windows
and can be passed unchanged to those windows drawing apis
<caolan> so I guess remove SalPoint entirely, use Point instead,
and convert to "POINT" under windows ?
Change-Id: Ic15a7f4516e2075a228fa65cac4e8494d5b3abaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105634
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 50 | ||||
-rw-r--r-- | vcl/source/outdev/curvedshapes.cxx | 8 | ||||
-rw-r--r-- | vcl/source/outdev/line.cxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/polygon.cxx | 22 | ||||
-rw-r--r-- | vcl/source/outdev/polyline.cxx | 6 | ||||
-rw-r--r-- | vcl/source/outdev/rect.cxx | 4 |
6 files changed, 47 insertions, 47 deletions
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 4b6891dc6936..5878ebdd8e73 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -202,7 +202,7 @@ void SalGraphics::mirror( tools::Long& x, tools::Long nWidth, const OutputDevice x = w-nWidth-x; } -bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev ) const +bool SalGraphics::mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice *pOutDev ) const { const tools::Long w = GetDeviceWidth(pOutDev); if( w ) @@ -218,8 +218,8 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * tools::Long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { - pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); - pPtAry2[j].mnY = pPtAry[i].mnY; + pPtAry2[j].setX( devX + (pPtAry[i].getX() - pOutDevRef->GetOutOffXPixel()) ); + pPtAry2[j].setY( pPtAry[i].getY() ); } } else @@ -227,8 +227,8 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * tools::Long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { - pPtAry2[j].mnX = pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].mnX - devX) + pOutDevRef->GetOutOffXPixel() - 1; - pPtAry2[j].mnY = pPtAry[i].mnY; + pPtAry2[j].setX( pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].getX() - devX) + pOutDevRef->GetOutOffXPixel() - 1 ); + pPtAry2[j].setY( pPtAry[i].getY() ); } } } @@ -236,8 +236,8 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * { for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { - pPtAry2[j].mnX = w-1-pPtAry[i].mnX; - pPtAry2[j].mnY = pPtAry[i].mnY; + pPtAry2[j].setX( w-1-pPtAry[i].getX() ); + pPtAry2[j].setY( pPtAry[i].getY() ); } } return true; @@ -400,11 +400,11 @@ void SalGraphics::DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, drawRect( nX, nY, nWidth, nHeight ); } -void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, SalPoint const * pPtAry, const OutputDevice *pOutDev ) +void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - std::unique_ptr<SalPoint[]> pPtAry2(new SalPoint[nPoints]); + std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); drawPolyLine( nPoints, bCopied ? pPtAry2.get() : pPtAry ); } @@ -412,11 +412,11 @@ void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, SalPoint const * pPtAry, con drawPolyLine( nPoints, pPtAry ); } -void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) +void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - std::unique_ptr<SalPoint[]> pPtAry2(new SalPoint[nPoints]); + std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); drawPolygon( nPoints, bCopied ? pPtAry2.get() : pPtAry ); } @@ -424,21 +424,21 @@ void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const drawPolygon( nPoints, pPtAry ); } -void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) +void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls - std::unique_ptr<SalPoint*[]> pPtAry2( new SalPoint*[nPoly] ); + std::unique_ptr<Point*[]> pPtAry2( new Point*[nPoly] ); sal_uLong i; for(i=0; i<nPoly; i++) { sal_uLong nPoints = pPoints[i]; - pPtAry2[i] = new SalPoint[ nPoints ]; + pPtAry2[i] = new Point[ nPoints ]; mirror( nPoints, pPtAry[i], pPtAry2[i], pOutDev ); } - drawPolyPolygon( nPoly, pPoints, const_cast<PCONSTSALPOINT*>(pPtAry2.get()) ); + drawPolyPolygon( nPoly, pPoints, const_cast<const Point**>(pPtAry2.get()) ); for(i=0; i<nPoly; i++) delete [] pPtAry2[i]; @@ -486,12 +486,12 @@ bool SalGraphics::DrawPolyPolygon( i_fTransparency); } -bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry, const OutputDevice* pOutDev ) +bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry, const OutputDevice* pOutDev ) { bool bResult = false; if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - std::unique_ptr<SalPoint[]> pPtAry2(new SalPoint[nPoints]); + std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry ); } @@ -500,12 +500,12 @@ bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry return bResult; } -bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry, const OutputDevice* pOutDev ) +bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry, const OutputDevice* pOutDev ) { bool bResult = false; if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - std::unique_ptr<SalPoint[]> pPtAry2(new SalPoint[nPoints]); + std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry ); } @@ -515,22 +515,22 @@ bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, } bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i_pPoints, - const SalPoint* const* i_pPtAry, const PolyFlags* const* i_pFlgAry, const OutputDevice* i_pOutDev ) + const Point* const* i_pPtAry, const PolyFlags* const* i_pFlgAry, const OutputDevice* i_pOutDev ) { bool bRet = false; if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls - std::unique_ptr<SalPoint*[]> pPtAry2( new SalPoint*[i_nPoly] ); + std::unique_ptr<Point*[]> pPtAry2( new Point*[i_nPoly] ); sal_uLong i; for(i=0; i<i_nPoly; i++) { sal_uLong nPoints = i_pPoints[i]; - pPtAry2[i] = new SalPoint[ nPoints ]; + pPtAry2[i] = new Point[ nPoints ]; mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev ); } - bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<PCONSTSALPOINT const *>(pPtAry2.get()), i_pFlgAry ); + bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<const Point* const *>(pPtAry2.get()), i_pFlgAry ); for(i=0; i<i_nPoly; i++) delete [] pPtAry2[i]; @@ -690,11 +690,11 @@ void SalGraphics::Invert( tools::Long nX, tools::Long nY, tools::Long nWidth, to invert( nX, nY, nWidth, nHeight, nFlags ); } -void SalGraphics::Invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) +void SalGraphics::Invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - std::unique_ptr<SalPoint[]> pPtAry2(new SalPoint[nPoints]); + std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); invert( nPoints, bCopied ? pPtAry2.get() : pPtAry, nFlags ); } diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx index d25d69ad1918..a02abfb6e69e 100644 --- a/vcl/source/outdev/curvedshapes.cxx +++ b/vcl/source/outdev/curvedshapes.cxx @@ -55,7 +55,7 @@ void OutputDevice::DrawEllipse( const tools::Rectangle& rRect ) tools::Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 ); if ( aRectPoly.GetSize() >= 2 ) { - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aRectPoly.GetPointAry()); + Point* pPtAry = aRectPoly.GetPointAry(); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this ); else @@ -103,7 +103,7 @@ void OutputDevice::DrawArc( const tools::Rectangle& rRect, if ( aArcPoly.GetSize() >= 2 ) { - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aArcPoly.GetPointAry()); + Point* pPtAry = aArcPoly.GetPointAry(); mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this ); } @@ -144,7 +144,7 @@ void OutputDevice::DrawPie( const tools::Rectangle& rRect, if ( aPiePoly.GetSize() >= 2 ) { - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aPiePoly.GetPointAry()); + Point* pPtAry = aPiePoly.GetPointAry(); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this ); else @@ -192,7 +192,7 @@ void OutputDevice::DrawChord( const tools::Rectangle& rRect, if ( aChordPoly.GetSize() >= 2 ) { - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aChordPoly.GetPointAry()); + Point* pPtAry = aChordPoly.GetPointAry(); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this ); else diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx index a715c25521ae..95d2c44458d7 100644 --- a/vcl/source/outdev/line.cxx +++ b/vcl/source/outdev/line.cxx @@ -252,7 +252,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin tools::Polygon aPolygon(rB2DPolygon); mpGraphics->DrawPolyLine( aPolygon.GetSize(), - reinterpret_cast<SalPoint*>(aPolygon.GetPointAry()), + aPolygon.GetPointAry(), this); } } @@ -287,7 +287,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin // need to subdivide, mpGraphics->DrawPolygon ignores curves aPolygon.AdaptiveSubdivide(aPolygon); - mpGraphics->DrawPolygon(aPolygon.GetSize(), reinterpret_cast<const SalPoint*>(aPolygon.GetConstPointAry()), this); + mpGraphics->DrawPolygon(aPolygon.GetSize(), aPolygon.GetConstPointAry(), this); } } diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index 4d76578d376a..208858fc381b 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -230,7 +230,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly ) } tools::Polygon aPoly = ImplLogicToDevicePixel( rPoly ); - const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); + const Point* pPtAry = aPoly.GetConstPointAry(); // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) @@ -239,7 +239,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly ) if( !mpGraphics->DrawPolygonBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = tools::Polygon::SubdivideBezier(aPoly); - pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); + pPtAry = aPoly.GetConstPointAry(); mpGraphics->DrawPolygon( aPoly.GetSize(), pPtAry, this ); } } @@ -356,10 +356,10 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg return; sal_uInt32 aStackAry1[OUTDEV_POLYPOLY_STACKBUF]; - PCONSTSALPOINT aStackAry2[OUTDEV_POLYPOLY_STACKBUF]; + const Point* aStackAry2[OUTDEV_POLYPOLY_STACKBUF]; PolyFlags* aStackAry3[OUTDEV_POLYPOLY_STACKBUF]; sal_uInt32* pPointAry; - PCONSTSALPOINT* pPointAryAry; + const Point** pPointAryAry; const PolyFlags** pFlagAryAry; sal_uInt16 i = 0; sal_uInt16 j = 0; @@ -368,7 +368,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg if ( nPoly > OUTDEV_POLYPOLY_STACKBUF ) { pPointAry = new sal_uInt32[nPoly]; - pPointAryAry = new PCONSTSALPOINT[nPoly]; + pPointAryAry = new const Point*[nPoly]; pFlagAryAry = new const PolyFlags*[nPoly]; } else @@ -385,7 +385,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg if ( nSize ) { pPointAry[j] = nSize; - pPointAryAry[j] = reinterpret_cast<PCONSTSALPOINT>(rPoly.GetConstPointAry()); + pPointAryAry[j] = rPoly.GetConstPointAry(); pFlagAryAry[j] = rPoly.GetConstFlagAry(); last = i; @@ -406,7 +406,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg if( !mpGraphics->DrawPolygonBezier( *pPointAry, *pPointAryAry, *pFlagAryAry, this ) ) { tools::Polygon aPoly = tools::Polygon::SubdivideBezier( rPolyPoly.GetObject( last ) ); - mpGraphics->DrawPolygon( aPoly.GetSize(), reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()), this ); + mpGraphics->DrawPolygon( aPoly.GetSize(), aPoly.GetConstPointAry(), this ); } } else @@ -452,7 +452,7 @@ void OutputDevice::ImplDrawPolygon( const tools::Polygon& rPoly, const tools::Po if ( nPoints < 2 ) return; - const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(rPoly.GetConstPointAry()); + const Point* pPtAry = rPoly.GetConstPointAry(); mpGraphics->DrawPolygon( nPoints, pPtAry, this ); } } @@ -477,7 +477,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con if( nSize >= 2 ) { - const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(rPoly.GetConstPointAry()); + const Point* pPtAry = rPoly.GetConstPointAry(); mpGraphics->DrawPolygon( nSize, pPtAry, this ); } } @@ -485,7 +485,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con { sal_uInt16 nCount = pPolyPoly->Count(); std::unique_ptr<sal_uInt32[]> pPointAry(new sal_uInt32[nCount]); - std::unique_ptr<PCONSTSALPOINT[]> pPointAryAry(new PCONSTSALPOINT[nCount]); + std::unique_ptr<const Point*[]> pPointAryAry(new const Point*[nCount]); sal_uInt16 i = 0; do { @@ -494,7 +494,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con if ( nSize ) { pPointAry[i] = nSize; - pPointAryAry[i] = reinterpret_cast<PCONSTSALPOINT>(rPoly.GetConstPointAry()); + pPointAryAry[i] = rPoly.GetConstPointAry(); i++; } else diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index a1bd0df6f82e..a79ebf74ab6f 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -82,7 +82,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly ) if(!bDrawn) { tools::Polygon aPoly = ImplLogicToDevicePixel( rPoly ); - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry()); + Point* pPtAry = aPoly.GetPointAry(); // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) @@ -91,7 +91,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly ) if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = tools::Polygon::SubdivideBezier(aPoly); - pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry()); + pPtAry = aPoly.GetPointAry(); mpGraphics->DrawPolyLine( aPoly.GetSize(), pPtAry, this ); } } @@ -280,7 +280,7 @@ void OutputDevice::drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLi nPoints = aPoly.GetSize(); } - mpGraphics->DrawPolyLine(nPoints, reinterpret_cast<SalPoint*>(aPoly.GetPointAry()), this); + mpGraphics->DrawPolyLine(nPoints, aPoly.GetPointAry(), this); } if( mpAlphaVDev ) diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 9252959d0f5e..c6a53fbee3c0 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -131,7 +131,7 @@ void OutputDevice::DrawRect( const tools::Rectangle& rRect, if ( aRoundRectPoly.GetSize() >= 2 ) { - SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aRoundRectPoly.GetPointAry()); + Point* pPtAry = aRoundRectPoly.GetPointAry(); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry, this ); @@ -202,7 +202,7 @@ void OutputDevice::Invert( const tools::Polygon& rPoly, InvertFlags nFlags ) nSalFlags |= SalInvert::N50; if ( nFlags & InvertFlags::TrackFrame ) nSalFlags |= SalInvert::TrackFrame; - const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); + const Point* pPtAry = aPoly.GetConstPointAry(); mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this ); } |