diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-05-11 22:44:38 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-05-12 10:32:19 +0200 |
commit | 876d8ffeeeb6168f553d2035954fdb5aa9ad1d66 (patch) | |
tree | 682ad5c8635d76e5152b6e4ab8e03453fc6c0ddf /include/basegfx | |
parent | 3466488ef22752c8f6f47f7b8f1dac5cc0cb27a2 (diff) |
basegfx: simplify namespaces in ALL basegfx headers
Change-Id: Iaf9426507e3822363e69dff2cae2b22f34b1b26c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94034
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/basegfx')
23 files changed, 194 insertions, 296 deletions
diff --git a/include/basegfx/color/bcolortools.hxx b/include/basegfx/color/bcolortools.hxx index 4a1574da4cdf..5c16802cff4a 100644 --- a/include/basegfx/color/bcolortools.hxx +++ b/include/basegfx/color/bcolortools.hxx @@ -21,22 +21,21 @@ #include <basegfx/basegfxdllapi.h> -namespace basegfx +namespace basegfx { class BColor; } + +namespace basegfx::utils { - class BColor; - - namespace utils - { - /// Transform from RGB to HSL - BASEGFX_DLLPUBLIC BColor rgb2hsl(const BColor& rRGBColor); - /// Transform from HSL to RGB - BASEGFX_DLLPUBLIC BColor hsl2rgb(const BColor& rHSLColor); - - /// Transform from RGB to HSV - BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor); - /// Transform from HSV to RGB - BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor); - } + +/// Transform from RGB to HSL +BASEGFX_DLLPUBLIC BColor rgb2hsl(const BColor& rRGBColor); +/// Transform from HSL to RGB +BASEGFX_DLLPUBLIC BColor hsl2rgb(const BColor& rHSLColor); + +/// Transform from RGB to HSV +BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor); +/// Transform from HSV to RGB +BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor); + } // end of namespace basegfx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx index 471d99c14197..b7159aef6165 100644 --- a/include/basegfx/matrix/b2dhommatrixtools.hxx +++ b/include/basegfx/matrix/b2dhommatrixtools.hxx @@ -28,10 +28,8 @@ namespace basegfx { class B2DRange; } -namespace basegfx +namespace basegfx::utils { - namespace utils - { /** If the rotation angle is an approximate multiple of pi/2, force fSin/fCos to -1/0/1, to maintain orthogonality (which might also be advantageous for the other cases, but: for @@ -148,14 +146,7 @@ namespace basegfx /// get column vector from B2dHomMatrix, e.g. to extract coordinate system origin and x/yaxis BASEGFX_DLLPUBLIC B2DTuple getColumn(const B2DHomMatrix& rMatrix, sal_uInt16 nCol); - } // end of namespace utils -} // end of namespace basegfx - -namespace basegfx -{ - namespace utils - { class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedDecompose { private: @@ -186,14 +177,7 @@ namespace basegfx double getRotate() const { return mfRotate; } double getShearX() const { return mfShearX; } }; - } // end of namespace utils -} // end of namespace basegfx - -namespace basegfx -{ - namespace utils - { class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedOnDemandDecompose { private: @@ -232,8 +216,6 @@ namespace basegfx double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; } double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; } }; - } // end of namespace utils - -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/matrix/b3dhommatrixtools.hxx b/include/basegfx/matrix/b3dhommatrixtools.hxx index 32a64d2ed037..6b65d24603f2 100644 --- a/include/basegfx/matrix/b3dhommatrixtools.hxx +++ b/include/basegfx/matrix/b3dhommatrixtools.hxx @@ -22,23 +22,12 @@ #include <basegfx/basegfxdllapi.h> #include <basegfx/matrix/b3dhommatrix.hxx> -namespace com -{ -namespace sun -{ -namespace star -{ -namespace drawing +namespace com::sun::star::drawing { struct HomogenMatrix; } -} -} -} -namespace basegfx -{ -namespace utils +namespace basegfx::utils { /* tooling methods for converting API matrices (drawing::HomogenMatrix) to B3DHomMatrix. drawing::HomogenMatrix4 is not used by OOo @@ -50,7 +39,6 @@ BASEGFX_DLLPUBLIC void B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn, com::sun::star::drawing::HomogenMatrix& rMatrixOut); -} // end of namespace tools -} // end of namespace basegfx +} // end of namespace basegfx::tools /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx index 7a77140c8f89..0e9f5241b866 100644 --- a/include/basegfx/polygon/b2dlinegeometry.hxx +++ b/include/basegfx/polygon/b2dlinegeometry.hxx @@ -26,10 +26,8 @@ #include <basegfx/basegfxdllapi.h> #include <basegfx/polygon/b2dpolygontriangulator.hxx> -namespace basegfx +namespace basegfx::utils { - namespace utils - { /** Create line start/end geometry element, mostly arrows and things like that. @param rCandidate @@ -144,7 +142,6 @@ namespace basegfx double fMiterMinimumAngle = basegfx::deg2rad(15.0), basegfx::triangulator::B2DTriangleVector* pTriangles = nullptr); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolygonclipper.hxx b/include/basegfx/polygon/b2dpolygonclipper.hxx index 1c10901fe929..b080fdcb5e24 100644 --- a/include/basegfx/polygon/b2dpolygonclipper.hxx +++ b/include/basegfx/polygon/b2dpolygonclipper.hxx @@ -23,44 +23,42 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/basegfxdllapi.h> - namespace basegfx { - // predefinitions class B2DRange; +} - namespace utils - { - // This method clips the given tools::PolyPolygon against a horizontal or vertical axis (parallel to X or Y axis). The axis is - // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the - // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define - // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100. - // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y). - // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke); - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke); +namespace basegfx::utils +{ + // This method clips the given tools::PolyPolygon against a horizontal or vertical axis (parallel to X or Y axis). The axis is + // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the + // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define + // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100. + // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y). + // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke); + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke); - // Clip the given tools::PolyPolygon against the given range. bInside defines if the result will contain the - // parts which are contained in the range or vice versa. - // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke); - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnRange(const B2DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke); + // Clip the given tools::PolyPolygon against the given range. bInside defines if the result will contain the + // parts which are contained in the range or vice versa. + // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke); + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnRange(const B2DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke); - // Clip given tools::PolyPolygon against given clipping polygon. - // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). - // With stroke polygons, You get all line snippets inside rCip. - // With filled polygons, You get all tools::PolyPolygon parts which were inside rClip. - // The switch bInside decides if the parts inside the clip polygon or outside shall be created. - // The clip polygon is always assumed closed, even when it's isClosed() is false. - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke); - BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke); + // Clip given tools::PolyPolygon against given clipping polygon. + // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true). + // With stroke polygons, You get all line snippets inside rCip. + // With filled polygons, You get all tools::PolyPolygon parts which were inside rClip. + // The switch bInside decides if the parts inside the clip polygon or outside shall be created. + // The clip polygon is always assumed closed, even when it's isClosed() is false. + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke); + BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke); - // clip the given polygon against the given range. the resulting polygon will always contain - // the inside parts which will always be interpreted as areas. the incoming polygon is expected - // to be a simple triangle list. the result is also a simple triangle list. - BASEGFX_DLLPUBLIC B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange ); + // clip the given polygon against the given range. the resulting polygon will always contain + // the inside parts which will always be interpreted as areas. the incoming polygon is expected + // to be a simple triangle list. the result is also a simple triangle list. + BASEGFX_DLLPUBLIC B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange ); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolygoncutandtouch.hxx b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx index 357bf5bc97d2..24f8e1a9f876 100644 --- a/include/basegfx/polygon/b2dpolygoncutandtouch.hxx +++ b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx @@ -23,29 +23,26 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/basegfxdllapi.h> - -namespace basegfx +namespace basegfx::utils { - namespace utils - { - // look for self-intersections and self-touches (points on an edge) in given polygon and add - // extra points there. Result will have no touches or intersections on an edge, only on points - BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate); - - // look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given tools::PolyPolygon and add - // extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For - // convenience, the correction for self-intersections for each member polygon will be used, too. - BASEGFX_DLLPUBLIC B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate); - - // look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there. - // Points are only added in the range of the edge, not on the endless vector. - BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd); - - // look for intersections of rCandidate with the mask Polygon and add extra points there. - // The mask polygon is assumed to be closed, even when it's not explicitly. - BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask); - - } // end of namespace utils + +// look for self-intersections and self-touches (points on an edge) in given polygon and add +// extra points there. Result will have no touches or intersections on an edge, only on points +BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate); + +// look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given tools::PolyPolygon and add +// extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For +// convenience, the correction for self-intersections for each member polygon will be used, too. +BASEGFX_DLLPUBLIC B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate); + +// look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there. +// Points are only added in the range of the edge, not on the endless vector. +BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd); + +// look for intersections of rCandidate with the mask Polygon and add extra points there. +// The mask polygon is assumed to be closed, even when it's not explicitly. +BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask); + } // end of namespace basegfx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx index a36c3c208927..40a4027a507d 100644 --- a/include/basegfx/polygon/b2dpolygontools.hxx +++ b/include/basegfx/polygon/b2dpolygontools.hxx @@ -54,12 +54,12 @@ namespace o3tl namespace basegfx { - // predefinitions class B2DPolygon; class B2DRange; +} - namespace utils - { +namespace basegfx::utils +{ // B2DPolygon tools // open/close with point add/remove and control point corrections @@ -524,7 +524,6 @@ namespace basegfx */ BASEGFX_DLLPUBLIC OUString exportToSvgPoints( const B2DPolygon& rPoly ); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolygontriangulator.hxx b/include/basegfx/polygon/b2dpolygontriangulator.hxx index bbc01239b994..1fb2c9d5428a 100644 --- a/include/basegfx/polygon/b2dpolygontriangulator.hxx +++ b/include/basegfx/polygon/b2dpolygontriangulator.hxx @@ -27,10 +27,8 @@ namespace basegfx { class B2DPolyPolygon; } -namespace basegfx +namespace basegfx::triangulator { - namespace triangulator - { // Simple B2D-based triangle. Main reason is to // keep the data types separated (before a B2DPolygon // was used with the convention that three points in @@ -68,7 +66,6 @@ namespace basegfx // triangulate given PolyPolygon BASEGFX_DLLPUBLIC B2DTriangleVector triangulate(const ::basegfx::B2DPolyPolygon& rCandidate); - } // end of namespace triangulator -} // end of namespace basegfx +} // end of namespace basegfx::triangulator /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolypolygoncutter.hxx b/include/basegfx/polygon/b2dpolypolygoncutter.hxx index f09d3ca6e815..a5f4ba6626af 100644 --- a/include/basegfx/polygon/b2dpolypolygoncutter.hxx +++ b/include/basegfx/polygon/b2dpolypolygoncutter.hxx @@ -23,10 +23,8 @@ #include <basegfx/basegfxdllapi.h> -namespace basegfx +namespace basegfx::utils { - namespace utils - { /** Solve all crossovers (aka self-intersections) in a polyPolygon. This re-layouts all contained polygons so that the result @@ -140,7 +138,6 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B2DPolyPolygon mergeToSinglePolyPolygon(const B2DPolyPolygonVector& rInput); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx index 4947d4be9233..9a83ab4549d7 100644 --- a/include/basegfx/polygon/b2dpolypolygontools.hxx +++ b/include/basegfx/polygon/b2dpolypolygontools.hxx @@ -31,12 +31,12 @@ namespace com::sun::star::drawing { struct PolyPolygonBezierCoords; } namespace basegfx { - // predefinitions class B2DPolyPolygon; class B2DRange; +} - namespace utils - { +namespace basegfx::utils +{ // B2DPolyPolygon tools // Check and evtl. correct orientations of all contained Polygons so that @@ -293,7 +293,6 @@ namespace basegfx const B2DPolyPolygon& rPolyPolygon, css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsRetval); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b2dtrapezoid.hxx b/include/basegfx/polygon/b2dtrapezoid.hxx index 5bcc614d149c..abe0c5c4e14d 100644 --- a/include/basegfx/polygon/b2dtrapezoid.hxx +++ b/include/basegfx/polygon/b2dtrapezoid.hxx @@ -75,38 +75,34 @@ namespace basegfx } // end of namespace basegfx -namespace basegfx +namespace basegfx::utils { - namespace utils - { - // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to - // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves, - // it's default AdaptiveSubdivision will be used. - // CAUTION: Trapezoids are orientation-dependent in the sense that the upper and lower - // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable - // for primitive decompositions. To use it, the shear and rotate parts of the - // involved transformations HAVE to be taken into account. - BASEGFX_DLLPUBLIC void trapezoidSubdivide( - B2DTrapezoidVector& ro_Result, - const B2DPolyPolygon& rSourcePolyPolygon); - - // directly create trapezoids from given edge. Depending on the given geometry, - // none up to three trapezoids will be created - BASEGFX_DLLPUBLIC void createLineTrapezoidFromEdge( - B2DTrapezoidVector& ro_Result, - const B2DPoint& rPointA, - const B2DPoint& rPointB, - double fLineWidth); - - // create trapezoids for all edges of the given polygon. The closed state of - // the polygon is taken into account. If curves are contained, the default - // AdaptiveSubdivision will be used. - BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolygon( - B2DTrapezoidVector& ro_Result, - const B2DPolygon& rPolygon, - double fLineWidth); - - } // end of namespace utils -} // end of namespace basegfx + // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to + // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves, + // it's default AdaptiveSubdivision will be used. + // CAUTION: Trapezoids are orientation-dependent in the sense that the upper and lower + // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable + // for primitive decompositions. To use it, the shear and rotate parts of the + // involved transformations HAVE to be taken into account. + BASEGFX_DLLPUBLIC void trapezoidSubdivide( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rSourcePolyPolygon); + + // directly create trapezoids from given edge. Depending on the given geometry, + // none up to three trapezoids will be created + BASEGFX_DLLPUBLIC void createLineTrapezoidFromEdge( + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, + double fLineWidth); + + // create trapezoids for all edges of the given polygon. The closed state of + // the polygon is taken into account. If curves are contained, the default + // AdaptiveSubdivision will be used. + BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolygon& rPolygon, + double fLineWidth); +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx index 7582b188711b..67ff859b6186 100644 --- a/include/basegfx/polygon/b3dpolygontools.hxx +++ b/include/basegfx/polygon/b3dpolygontools.hxx @@ -26,17 +26,15 @@ #include <basegfx/vector/b3dvector.hxx> #include <basegfx/basegfxdllapi.h> - -namespace basegfx { class B3DPolyPolygon; } - namespace basegfx { - // predefinitions + class B3DPolyPolygon; class B3DPolygon; class B3DRange; +} - namespace utils - { +namespace basegfx::utils +{ // B3DPolygon tools /** Check if given polygon is closed. This is kind of a @@ -126,7 +124,6 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx index 77bcf0fb955c..cd51ac9e6524 100644 --- a/include/basegfx/polygon/b3dpolypolygontools.hxx +++ b/include/basegfx/polygon/b3dpolypolygontools.hxx @@ -23,17 +23,16 @@ #include <basegfx/point/b3dpoint.hxx> #include <basegfx/basegfxdllapi.h> - namespace com::sun::star::drawing { struct PolyPolygonShape3D; } namespace basegfx { - // predefinitions class B3DPolyPolygon; class B3DRange; +} - namespace utils - { +namespace basegfx::utils +{ // B3DPolyPolygon tools // get size of PolyPolygon. Control vectors are included in that ranges. @@ -129,7 +128,6 @@ namespace basegfx const B3DPolyPolygon& rPolyPolygonSource, css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DRetval); - } // end of namespace utils -} // end of namespace basegfx +} // end of namespace basegfx::utils /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/raster/rasterconvert3d.hxx b/include/basegfx/raster/rasterconvert3d.hxx index 9179f175d696..59a309c865f7 100644 --- a/include/basegfx/raster/rasterconvert3d.hxx +++ b/include/basegfx/raster/rasterconvert3d.hxx @@ -62,10 +62,7 @@ namespace basegfx void increment(double fStep) { mfVal += fStep * mfInc; } }; -} // end of namespace basegfx -namespace basegfx -{ class ip_double { private: @@ -88,10 +85,7 @@ namespace basegfx void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); } }; -} // end of namespace basegfx -namespace basegfx -{ class ip_triple { private: @@ -118,14 +112,10 @@ namespace basegfx void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); maZ.increment(fStep); } }; -} // end of namespace basegfx + // InterpolatorProvider3D to have a common source for allocating interpolators + // which may then be addressed using the index to the vectors -// InterpolatorProvider3D to have a common source for allocating interpolators -// which may then be addressed using the index to the vectors - -namespace basegfx -{ #define SCANLINE_EMPTY_INDEX (0xffffffff) class InterpolatorProvider3D @@ -303,13 +293,9 @@ namespace basegfx ::std::vector< ip_double >& getTextureInterpolators() { return maTextureInterpolators; } ::std::vector< ip_triple >& getInverseTextureInterpolators() { return maInverseTextureInterpolators; } }; -} // end of namespace basegfx - -// RasterConversionLineEntry3D for Rasterconversion of 3D PolyPolygons + // RasterConversionLineEntry3D for Rasterconversion of 3D PolyPolygons -namespace basegfx -{ class RasterConversionLineEntry3D { private: @@ -400,14 +386,10 @@ namespace basegfx sal_uInt32 getTextureIndex() const { return mnTextureIndex; } sal_uInt32 getInverseTextureIndex() const { return mnInverseTextureIndex; } }; -} // end of namespace basegfx - -// the basic RasterConverter itself. Only one method needs to be overridden. The -// class itself is pure virtual + // the basic RasterConverter itself. Only one method needs to be overridden. The + // class itself is pure virtual -namespace basegfx -{ class UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) RasterConverter3D : public InterpolatorProvider3D { private: diff --git a/include/basegfx/utils/b2dclipstate.hxx b/include/basegfx/utils/b2dclipstate.hxx index b145dac33fc7..f4d9d9e7d67f 100644 --- a/include/basegfx/utils/b2dclipstate.hxx +++ b/include/basegfx/utils/b2dclipstate.hxx @@ -28,9 +28,10 @@ namespace basegfx class B2DRange; class B2DPolyPolygon; class B2DHomMatrix; +} - namespace utils - { +namespace basegfx::utils +{ class ImplB2DClipState; /** This class provides an optimized, symbolic clip state for graphical output @@ -86,7 +87,6 @@ namespace basegfx B2DPolyPolygon const & getClipPoly() const; }; - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/utils/canvastools.hxx b/include/basegfx/utils/canvastools.hxx index ecf5a594f588..d4cfa0a5cfba 100644 --- a/include/basegfx/utils/canvastools.hxx +++ b/include/basegfx/utils/canvastools.hxx @@ -60,9 +60,10 @@ namespace basegfx class B2IRange; class B2DPolygon; class B2DPolyPolygon; +} - namespace unotools - { +namespace basegfx::unotools +{ // Polygon conversions @@ -159,8 +160,6 @@ namespace basegfx which completely contains rRange. */ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); - - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/utils/keystoplerp.hxx b/include/basegfx/utils/keystoplerp.hxx index a68336f71ba1..302020ac337e 100644 --- a/include/basegfx/utils/keystoplerp.hxx +++ b/include/basegfx/utils/keystoplerp.hxx @@ -26,10 +26,8 @@ namespace com::sun::star::uno { template<typename T> class Sequence; } -namespace basegfx +namespace basegfx::utils { - namespace utils - { /** Lerp in a vector of key stops This class holds a key stop vector and provides the @@ -82,7 +80,6 @@ namespace basegfx std::vector<double> maKeyStops; mutable std::ptrdiff_t mnLastIndex; }; - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/utils/lerp.hxx b/include/basegfx/utils/lerp.hxx index 409b26c92d4a..e02b3b0fa51b 100644 --- a/include/basegfx/utils/lerp.hxx +++ b/include/basegfx/utils/lerp.hxx @@ -19,27 +19,24 @@ #pragma once -namespace basegfx +namespace basegfx::utils { - namespace utils - { - /** Generic linear interpolator + /** Generic linear interpolator - @tpl ValueType - Must have operator+ and operator* defined, and should - have value semantics. + @tpl ValueType + Must have operator+ and operator* defined, and should + have value semantics. - @param t - As usual, t must be in the [0,1] range - */ - template< typename ValueType > ValueType lerp( const ValueType& rFrom, - const ValueType& rTo, - double t ) - { - // This is only to suppress a double->int warning. All other - // types should be okay here. - return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo ); - } + @param t + As usual, t must be in the [0,1] range + */ + template< typename ValueType > ValueType lerp( const ValueType& rFrom, + const ValueType& rTo, + double t ) + { + // This is only to suppress a double->int warning. All other + // types should be okay here. + return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo ); } } diff --git a/include/basegfx/utils/rectcliptools.hxx b/include/basegfx/utils/rectcliptools.hxx index a187645f541d..b1354a6cac87 100644 --- a/include/basegfx/utils/rectcliptools.hxx +++ b/include/basegfx/utils/rectcliptools.hxx @@ -23,53 +23,49 @@ #include <basegfx/range/b2ibox.hxx> -namespace basegfx +namespace basegfx::utils { - namespace utils + namespace RectClipFlags { - namespace RectClipFlags - { - static const sal_uInt32 LEFT = sal_Int32(0x01); - static const sal_uInt32 RIGHT = sal_Int32(0x02); - static const sal_uInt32 TOP = sal_Int32(0x04); - static const sal_uInt32 BOTTOM = sal_Int32(0x08); - } - - /** Calc clip mask for Cohen-Sutherland rectangle clip + static const sal_uInt32 LEFT = sal_Int32(0x01); + static const sal_uInt32 RIGHT = sal_Int32(0x02); + static const sal_uInt32 TOP = sal_Int32(0x04); + static const sal_uInt32 BOTTOM = sal_Int32(0x08); + } - This function returns a clip mask used for the - Cohen-Sutherland rectangle clip method, where one or more - of the lower four bits are set, if the given point is - outside one or more of the four half planes defining the - rectangle (see RectClipFlags for possible values) - */ - template< class Point, class Rect > inline - sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, - const Rect& rR ) - { - // maxY | minY | maxX | minX - sal_uInt32 clip; - clip = (rP.getX() < rR.getMinX()) << 0; - clip |= (rP.getX() > rR.getMaxX()) << 1; - clip |= (rP.getY() < rR.getMinY()) << 2; - clip |= (rP.getY() > rR.getMaxY()) << 3; - return clip; - } + /** Calc clip mask for Cohen-Sutherland rectangle clip - /// Cohen-Sutherland mask calculation - overload for boxes. - template< class Point > inline - sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, - const B2IBox& rB ) - { - // maxY | minY | maxX | minX - sal_uInt32 clip; - clip = (rP.getX() < rB.getMinX()) << 0; - clip |= (rP.getX() >= rB.getMaxX()) << 1; - clip |= (rP.getY() < rB.getMinY()) << 2; - clip |= (rP.getY() >= rB.getMaxY()) << 3; - return clip; - } + This function returns a clip mask used for the + Cohen-Sutherland rectangle clip method, where one or more + of the lower four bits are set, if the given point is + outside one or more of the four half planes defining the + rectangle (see RectClipFlags for possible values) + */ + template< class Point, class Rect > inline + sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, + const Rect& rR ) + { + // maxY | minY | maxX | minX + sal_uInt32 clip; + clip = (rP.getX() < rR.getMinX()) << 0; + clip |= (rP.getX() > rR.getMaxX()) << 1; + clip |= (rP.getY() < rR.getMinY()) << 2; + clip |= (rP.getY() > rR.getMaxY()) << 3; + return clip; + } + /// Cohen-Sutherland mask calculation - overload for boxes. + template< class Point > inline + sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, + const B2IBox& rB ) + { + // maxY | minY | maxX | minX + sal_uInt32 clip; + clip = (rP.getX() < rB.getMinX()) << 0; + clip |= (rP.getX() >= rB.getMaxX()) << 1; + clip |= (rP.getY() < rB.getMinY()) << 2; + clip |= (rP.getY() >= rB.getMaxY()) << 3; + return clip; } } diff --git a/include/basegfx/utils/systemdependentdata.hxx b/include/basegfx/utils/systemdependentdata.hxx index 62562b488e1b..120e39a0e595 100644 --- a/include/basegfx/utils/systemdependentdata.hxx +++ b/include/basegfx/utils/systemdependentdata.hxx @@ -20,10 +20,7 @@ namespace basegfx class SystemDependentData; typedef std::shared_ptr<SystemDependentData> SystemDependentData_SharedPtr; typedef std::weak_ptr<SystemDependentData> SystemDependentData_WeakPtr; -} // end of namespace basegfx -namespace basegfx -{ class BASEGFX_DLLPUBLIC SystemDependentDataManager { private: @@ -44,10 +41,7 @@ namespace basegfx // flush all buffered data (e.g. cleanup/shutdown) virtual void flushAll() = 0; }; -} // end of namespace basegfx -namespace basegfx -{ class BASEGFX_DLLPUBLIC MinimalSystemDependentDataManager final : public SystemDependentDataManager { private: @@ -73,10 +67,7 @@ namespace basegfx virtual void touchUsage(basegfx::SystemDependentData_SharedPtr& rData) override; virtual void flushAll() override; }; -} // end of namespace basegfx -namespace basegfx -{ class BASEGFX_DLLPUBLIC SystemDependentData { private: @@ -120,10 +111,7 @@ namespace basegfx // offer useful data if you want to have better caching. virtual sal_Int64 estimateUsageInBytes() const; }; -} // end of namespace basegfx -namespace basegfx -{ class BASEGFX_DLLPUBLIC SystemDependentDataHolder { private: diff --git a/include/basegfx/utils/tools.hxx b/include/basegfx/utils/tools.hxx index 7992777f4686..f8fc61999505 100644 --- a/include/basegfx/utils/tools.hxx +++ b/include/basegfx/utils/tools.hxx @@ -27,9 +27,10 @@ namespace basegfx class B2DPoint; class B2DRange; class B2DPolyPolygon; +} - namespace utils - { +namespace basegfx::utils +{ /** Expand given parallelogram, such that it extends beyond bound rect in a given direction. @@ -118,7 +119,6 @@ namespace basegfx sal_Int32 nTotalDigits, sal_Int32 nDecPlaces, bool bLitSegments=true); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/utils/unopolypolygon.hxx b/include/basegfx/utils/unopolypolygon.hxx index f6b17328405a..da95ebff2a6d 100644 --- a/include/basegfx/utils/unopolypolygon.hxx +++ b/include/basegfx/utils/unopolypolygon.hxx @@ -29,9 +29,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/basegfxdllapi.h> -namespace basegfx -{ -namespace unotools +namespace basegfx::unotools { typedef cppu::WeakComponentImplHelper< css::rendering::XLinePolyPolygon2D, @@ -103,6 +101,5 @@ namespace unotools css::rendering::FillRule meFillRule; }; } -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/utils/zoomtools.hxx b/include/basegfx/utils/zoomtools.hxx index 5543c8660b22..4d85e5dec533 100644 --- a/include/basegfx/utils/zoomtools.hxx +++ b/include/basegfx/utils/zoomtools.hxx @@ -11,16 +11,14 @@ #include <basegfx/basegfxdllapi.h> - -namespace basegfx +namespace basegfx::zoomtools { - /** This namespace provides functions for optimized geometric zooming - */ - namespace zoomtools - { - BASEGFX_DLLPUBLIC long zoomOut(long nCurrent); - BASEGFX_DLLPUBLIC long zoomIn(long nCurrent); - } + +/** This namespace provides functions for optimized geometric zooming +*/ +BASEGFX_DLLPUBLIC long zoomOut(long nCurrent); +BASEGFX_DLLPUBLIC long zoomIn(long nCurrent); + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |