diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-29 01:31:19 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-29 23:15:24 +0200 |
commit | 20070d12c85ae6db8d5b1374a49f92b34137c8b1 (patch) | |
tree | 44e449ee8309cba63c6b1458af66f0b9aad3259b /basegfx | |
parent | 2bad2224090eb2802111760ec83db230aeca0616 (diff) |
Drop uses of css::uno::Sequence::getConstArray in accessibility .. basegfx
where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1
(Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and
fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[]
in internal code 2021-11-05).
Change-Id: I14e3634d8e8dd294b673dcda4dde13f01c3e5112
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166813
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 41 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygontools.cxx | 21 | ||||
-rw-r--r-- | basegfx/source/polygon/b3dpolypolygontools.cxx | 25 |
3 files changed, 34 insertions, 53 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 482d35d4df1d..92beaa21fd0a 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3250,12 +3250,10 @@ namespace basegfx::utils if(nLength) { aRetval.reserve(nLength); - const css::awt::Point* pArray = rPointSequenceSource.getConstArray(); - const css::awt::Point* pArrayEnd = pArray + rPointSequenceSource.getLength(); - for(;pArray != pArrayEnd; pArray++) + for(auto& point : rPointSequenceSource) { - aRetval.append(B2DPoint(pArray->X, pArray->Y)); + aRetval.append(B2DPoint(point.X, point.Y)); } // check for closed state flag @@ -3301,7 +3299,7 @@ namespace basegfx::utils // copy first point if closed if(bIsClosed) { - *pSequence = *rPointSequenceRetval.getConstArray(); + *pSequence = rPointSequenceRetval[0]; } } else @@ -3317,8 +3315,8 @@ namespace basegfx::utils const css::drawing::PointSequence& rPointSequenceSource, const css::drawing::FlagSequence& rFlagSequenceSource) { - const sal_uInt32 nCount(static_cast<sal_uInt32>(rPointSequenceSource.getLength())); - OSL_ENSURE(nCount == static_cast<sal_uInt32>(rFlagSequenceSource.getLength()), + const sal_Int32 nCount(rPointSequenceSource.getLength()); + OSL_ENSURE(nCount == rFlagSequenceSource.getLength(), "UnoPolygonBezierCoordsToB2DPolygon: Unequal count of Points and Flags (!)"); // prepare new polygon @@ -3328,12 +3326,9 @@ namespace basegfx::utils { aRetval.reserve(nCount); - const css::awt::Point* pPointSequence = rPointSequenceSource.getConstArray(); - const css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceSource.getConstArray(); - // get first point and flag - B2DPoint aNewCoordinatePair(pPointSequence->X, pPointSequence->Y); pPointSequence++; - css::drawing::PolygonFlags ePolygonFlag(*pFlagSequence); pFlagSequence++; + B2DPoint aNewCoordinatePair(rPointSequenceSource[0].X, rPointSequenceSource[0].Y); + css::drawing::PolygonFlags ePolygonFlag(rFlagSequenceSource[0]); B2DPoint aControlA; B2DPoint aControlB; @@ -3344,16 +3339,16 @@ namespace basegfx::utils // add first point as start point aRetval.append(aNewCoordinatePair); - for(sal_uInt32 b(1); b < nCount;) + for(sal_Int32 b(1); b < nCount;) { // prepare loop bool bControlA(false); bool bControlB(false); // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) { @@ -3361,9 +3356,9 @@ namespace basegfx::utils bControlA = true; // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; } if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) @@ -3372,9 +3367,9 @@ namespace basegfx::utils bControlB = true; // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; } // two or no control points are consumed, another one would be an error. @@ -3559,7 +3554,7 @@ namespace basegfx::utils if(bClosed) { // add first point as closing point - *pPointSequence = *rPointSequenceRetval.getConstArray(); + *pPointSequence = rPointSequenceRetval[0]; *pFlagSequence = css::drawing::PolygonFlags_NORMAL; } } diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index faf734f6e79e..cccd168bde00 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -554,13 +554,10 @@ namespace basegfx::utils { B2DPolyPolygon aRetval; aRetval.reserve(rPointSequenceSequenceSource.getLength()); - const css::drawing::PointSequence* pPointSequence = rPointSequenceSequenceSource.getConstArray(); - const css::drawing::PointSequence* pPointSeqEnd = pPointSequence + rPointSequenceSequenceSource.getLength(); - for(;pPointSequence != pPointSeqEnd; pPointSequence++) + for (auto& rPointSequence : rPointSequenceSequenceSource) { - const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence); - aRetval.append(aNewPolygon); + aRetval.append(UnoPointSequenceToB2DPolygon(rPointSequence)); } return aRetval; @@ -595,23 +592,19 @@ namespace basegfx::utils const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource) { B2DPolyPolygon aRetval; - const sal_uInt32 nSequenceCount(static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Coordinates.getLength())); + const sal_Int32 nSequenceCount(rPolyPolygonBezierCoordsSource.Coordinates.getLength()); if(nSequenceCount) { - OSL_ENSURE(nSequenceCount == static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Flags.getLength()), + OSL_ENSURE(nSequenceCount == rPolyPolygonBezierCoordsSource.Flags.getLength(), "UnoPolyPolygonBezierCoordsToB2DPolyPolygon: unequal number of Points and Flags (!)"); - const css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsSource.Coordinates.getConstArray(); - const css::drawing::FlagSequence* pFlagSequence = rPolyPolygonBezierCoordsSource.Flags.getConstArray(); - for(sal_uInt32 a(0); a < nSequenceCount; a++) + for(sal_Int32 a(0); a < nSequenceCount; a++) { const B2DPolygon aNewPolygon(UnoPolygonBezierCoordsToB2DPolygon( - *pPointSequence, - *pFlagSequence)); + rPolyPolygonBezierCoordsSource.Coordinates[a], + rPolyPolygonBezierCoordsSource.Flags[a])); - pPointSequence++; - pFlagSequence++; aRetval.append(aNewPolygon); } } diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index ffd8bded4d59..856fc40dff7e 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -472,32 +472,25 @@ namespace basegfx::utils "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have the same " "length (!)" ); - const css::drawing::DoubleSequence* pInnerSequenceX = rPolyPolygonShape3DSource.SequenceX.getConstArray(); - const css::drawing::DoubleSequence* pInnerSequenceY = rPolyPolygonShape3DSource.SequenceY.getConstArray(); - const css::drawing::DoubleSequence* pInnerSequenceZ = rPolyPolygonShape3DSource.SequenceZ.getConstArray(); - for(sal_Int32 a(0); a < nOuterSequenceCount; a++) { basegfx::B3DPolygon aNewPolygon; - const sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength()); - assert(nInnerSequenceCount == pInnerSequenceY->getLength() - && nInnerSequenceCount == pInnerSequenceZ->getLength() + + auto& rInnerSequenceX = rPolyPolygonShape3DSource.SequenceX[a]; + auto& rInnerSequenceY = rPolyPolygonShape3DSource.SequenceY[a]; + auto& rInnerSequenceZ = rPolyPolygonShape3DSource.SequenceZ[a]; + + const sal_Int32 nInnerSequenceCount(rInnerSequenceX.getLength()); + assert(nInnerSequenceCount == rInnerSequenceY.getLength() + && nInnerSequenceCount == rInnerSequenceZ.getLength() && "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have " "the same length (!)"); - const double* pArrayX = pInnerSequenceX->getConstArray(); - const double* pArrayY = pInnerSequenceY->getConstArray(); - const double* pArrayZ = pInnerSequenceZ->getConstArray(); - for(sal_Int32 b(0); b < nInnerSequenceCount; b++) { - aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++)); + aNewPolygon.append(basegfx::B3DPoint(rInnerSequenceX[b], rInnerSequenceY[b], rInnerSequenceZ[b])); } - pInnerSequenceX++; - pInnerSequenceY++; - pInnerSequenceZ++; - // #i101520# correction is needed for imported polygons of old format, // see callers basegfx::utils::checkClosed(aNewPolygon); |