diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-02-20 18:54:13 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-02-21 20:07:46 +0100 |
commit | e07d741b61ddc8b13046ce6ea0c0921ce046a0cf (patch) | |
tree | 0e7f665fbdf0bce287ca69215edb4f9b2defba3a /svx/inc | |
parent | 34627ad7d03f93b89689b2e48a3985574d10f965 (diff) |
Revert "simplify ImpXPolygon"
This reverts commit f9c2bcc8b761f5e21354c0fb7bca6aa432d11ec2. Drawing all sorts
of curves and polygons in Draw causes various crashes in
svx/source/svdraw/svdopath.cxx, apparently because in the past ImpXPolygon's
pPointAry had a "buffer" of more elements (nSize) than it had nPoints, and the
code heavily relied on that, assigning to such excess elements of pPointAry past
nPoints (and presumably calling XPolygon::SetPointCount later?).
Conflicts:
svx/source/xoutdev/_xpoly.cxx
(Reverted the mostly, if not completely, automatic changes there done by
924c0e34fdc36cd44100dafc2c68656ce32374e6 "loplugin:changetoolsgen in svx"; they
will need to be re-done.)
Change-Id: I6cb41fd218c3bdd0b3bbeb45f5b3d68649901a48
Reviewed-on: https://gerrit.libreoffice.org/50057
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx/inc')
-rw-r--r-- | svx/inc/xpolyimp.hxx | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/svx/inc/xpolyimp.hxx b/svx/inc/xpolyimp.hxx index 76f4ae24c87f..fd0fe2905d8b 100644 --- a/svx/inc/xpolyimp.hxx +++ b/svx/inc/xpolyimp.hxx @@ -29,13 +29,26 @@ class Point; class ImpXPolygon { public: - std::vector<std::pair<Point, PolyFlags>> mvPointsAndFlags; - ImpXPolygon() = default; - ImpXPolygon(sal_uInt16 nSize) - { - mvPointsAndFlags.resize(nSize); - } - bool operator==(ImpXPolygon const & rOther) const { return mvPointsAndFlags == rOther.mvPointsAndFlags; } + Point* pPointAry; + std::unique_ptr<PolyFlags[]> + pFlagAry; + Point* pOldPointAry; + bool bDeleteOldPoints; + sal_uInt16 nSize; + sal_uInt16 nResize; + sal_uInt16 nPoints; + + ImpXPolygon( sal_uInt16 nInitSize, sal_uInt16 nResize=16 ); + ImpXPolygon( const ImpXPolygon& rImpXPoly ); + ~ImpXPolygon(); + + bool operator==(const ImpXPolygon& rImpXPoly) const; + + void CheckPointDelete() const; + + void Resize( sal_uInt16 nNewSize, bool bDeletePoints = true ); + void InsertSpace( sal_uInt16 nPos, sal_uInt16 nCount ); + void Remove( sal_uInt16 nPos, sal_uInt16 nCount ); }; class ImpXPolyPolygon |