Drop unneeded indirection and unused argument
[LibreOffice.git] / tools / inc / poly.h
blob6576beecaf97885434a30c4f66154b9b153f499e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include <sal/types.h>
22 #include <memory>
23 #include <tools/poly.hxx>
25 class SAL_WARN_UNUSED ImplPolygon
27 public:
28 std::unique_ptr<Point[]> mxPointAry;
29 std::unique_ptr<PolyFlags[]> mxFlagAry;
30 sal_uInt16 mnPoints;
32 public:
33 ImplPolygon() : mnPoints(0) {}
34 ImplPolygon( sal_uInt16 nInitSize );
35 ImplPolygon( sal_uInt16 nPoints, const Point* pPtAry, const PolyFlags* pInitFlags );
36 ImplPolygon( const ImplPolygon& rImplPoly );
37 ImplPolygon( ImplPolygon&& rImplPoly ) noexcept;
38 ImplPolygon( const tools::Rectangle& rRect );
39 ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound);
40 ImplPolygon( const Point& rCenter, tools::Long nRadX, tools::Long nRadY );
41 ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd,
42 PolyStyle eStyle, bool bClockWiseArcDirection );
43 ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, const Point& rBezPt2,
44 const Point& rCtrlPt2, sal_uInt16 nPoints );
45 ImplPolygon(const basegfx::B2DPolygon& rPolygon);
47 bool operator==( const ImplPolygon& rCandidate ) const;
49 void ImplInitSize(sal_uInt16 nInitSize, bool bFlags = false);
50 void ImplSetSize( sal_uInt16 nSize, bool bResize = true );
51 void ImplCreateFlagArray();
52 bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly = nullptr );
55 #define MAX_POLYGONS SAL_MAX_UINT16
57 struct ImplPolyPolygon
59 std::vector<tools::Polygon> mvPolyAry;
61 typedef std::vector<tools::Polygon>::iterator iterator;
62 typedef std::vector<tools::Polygon>::const_iterator const_iterator;
64 ImplPolyPolygon( sal_uInt16 nInitSize )
66 if ( !nInitSize )
67 nInitSize = 1;
68 mvPolyAry.reserve(nInitSize);
71 ImplPolyPolygon( const tools::Polygon& rPoly )
73 if ( rPoly.GetSize() )
74 mvPolyAry.push_back(rPoly);
75 else
76 mvPolyAry.reserve(16);
79 ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
81 bool operator==(ImplPolyPolygon const & other) const
83 return mvPolyAry == other.mvPolyAry;
86 iterator begin() { return mvPolyAry.begin(); }
87 iterator end() { return mvPolyAry.end(); }
89 const_iterator begin() const { return mvPolyAry.begin(); }
90 const_iterator end() const { return mvPolyAry.end(); }
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */