summaryrefslogtreecommitdiff
path: root/basegfx
AgeCommit message (Collapse)Author
2022-10-30tdf#126788 use singleton to avoid initial allocationNoel Grandin
Change-Id: I55011cdd3e6c457c6ab91d90579ace3524a9889d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-21basegfx: remove global ImplB2DPolyPolygonMike Kaganski
Similar to commit 7e911e9cd469d30369c213aa529675b3f7c4f0e8 Author Michael Stahl <mstahl@redhat.com> Date Fri Aug 25 20:51:22 2017 +0200 basegfx: remove global ImplB2DPolygon There shouldn't be allocations of the objects just to destroy them without populating with data (it there are, they should be optimized away); and for any reasonable use, defaulting to a shared instance means that there is an unnecessary refcount increase and decrease aside from inevitable allocation of the unique instance. Change-Id: Ia92c229165c0836e56778d9274f0728181048e8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140341 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-20tdf#151056: avoid modifying the static shared DEFAULT instanceMike Kaganski
This was a thinko in commit e39fa3c4f5ae2560a4b6f6f789a0c5098ac43cf4 Simplify b2d(poly)polygon implementation This led to exponential growth of elements in each next polypolygon created from scratch, that immediately manifested with the complex SVG logo shown on the backing window. And finally, there's no const_cast/as_const left in the file :) Change-Id: Ie60f75ec86a8fa21799f4f1b589c04c9e4646183 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140248 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-20Assert that cow_wrapped objects aren't called to do nothingMike Kaganski
An omission from commit e39fa3c4f5ae2560a4b6f6f789a0c5098ac43cf4 Simplify b2d(poly)polygon implementation Change-Id: Ib0b10e06baf91888f0e9797e670e0626f512af15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140229 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-17Simplify b2d(poly)polygon implementationMike Kaganski
Most size checks should be only done in the outer object; implementations inside cow_wrapper only assert correctness. All const_cast and as_const are replaced with correct const method calls (and, where needed, mutable members). Change-Id: I69e9f72086d07257ebd5cefaff7f214e198b901e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140106 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-15tdf#148251 Use std::swap() instead of using temporary valuesRadhey Parekh
Change-Id: Ifdf59f4957428efdc56009947f8c87f6b6351603 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139273 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-09-11basegfx: replace typedef with a class B2DSize based on Size2DTomaž Vajngerl
Change-Id: Id8b3c2bcf0bf4be5aba2812b0edda479bc20c6a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139683 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-09-10basegfx: simplify Tuple2D, B2DPoint, B2DVector, B2DTupleTomaž Vajngerl
Change-Id: I97e41fc62288ec4ee5805747fd3a3a6e019cfb57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139681 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-09-01reduce cost of B2DHomMatrix::isIdentityNoel Grandin
often the matrix is still default Change-Id: Ieacf19c375e9988487047309187fce6b5b8c9561 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139213 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-17ofz#48585 Out-of-memoryCaolán McNamara
Change-Id: If6bb603cc78863df88d5630b4bd5b1198b4050de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137148 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-07-14make B2DPolyPolygon thread-safeNoel Grandin
which is cheaper than copying it when querying from UnoPolyPolygon Change-Id: If4661dfdff7e277d5ef25a8f0c937e549f8be9f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137080 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-13basegfx: zoomIn() and zoomOut() should be sal_uInt16Chris Sherlock
All zoom functions use sal_uInt16 values. For some reason, basegfx used long when zoomIn and zoomOut were created in 2012 (see commit 315d2ddc16: "optimized zoom to use more common intervals"), this then got mass converted to tools::Long in commit 387a88fa25: "use tools::Long in basegfx..chart2". So fix is to change zoomIn/Out() to use sal_uInt16. Change-Id: I2a56d6f58e14f77aeb8741d332fe9bc282eb969f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135715 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-07-04tdf#137544 reserve space in polypolygonNoel Grandin
Change-Id: Ic8dc5b7479c1353487bac883fc0e704356e90798 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-04tdf#137544 no need to create a OUStringBuffer hereNoel Grandin
we can just pass a view here Change-Id: I71679106ee749f64eac4819c2a4f282e40865639 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-01tdf#137544 reserve space in polygonNoel Grandin
Change-Id: I868584965b122735b8eb55cc17a3ee11a772b88a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136721 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-01small optimisationNoel Grandin
Change-Id: I10d18eddf0dfa96d468c8cfab22494779e38358f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136718 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-27clang-tidy modernize-pass-by-value in basegfxNoel Grandin
Change-Id: I1ec34b2f0e9869a82894795f1d6351189ae92d9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135043 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20basegfx: add test for 2D vector classes B2DVector, B2IVectorTomaž Vajngerl
Change-Id: I300028f63c6222f7a4296aa9bf608acb3fa19dd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134652 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-16basegfx: remove CoordinateData2D class and use B2DPoint directlyTomaž Vajngerl
For some reason B2DPolygon used a CoordinateData2D class that derived from basegfx::B2DPoint with no added functionallity that is used in practice (just an explicit method transform instead of using an operator*=). This class has been removed and replaced with B2DPoint instead. Also removed was the typdef CoordinateData2DVector and calls to the std::vector's iterator (begin, end) have been simplified with "auto". Change-Id: I0d187ded05a8e22de36a8e17523e87871aab912c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134378 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-16basegfx: move ImplB2DPolyPolygon inside basegfx namespaceTomaž Vajngerl
also remove unneeded typedef Change-Id: I24fd31ff9da579260f1889ed87065f95dcfd1e23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134377 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-11basegfx: generalize B2DRange and B2IRange with Range2D templateTomaž Vajngerl
Also add and/or re-arrange B2DRange and B2IRange tests Change-Id: I0f582b30c92776ffbab8b69810ec855da0931714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134111 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-07ofz#46070 Out-of-memoryCaolán McNamara
Change-Id: Ibc242ae6b267d989997162d9a4dac9a409f172be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133993 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-27add string_view wrappers for rtl::math::stringToDoubleNoel Grandin
Change-Id: I114bec72cb933238675e539a8388a607226827cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133455 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26Use o3tl::make_unsigned in some placesStephan Bergmann
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I9665e6c2c4c5557f2d4cf1bb646f9fffc7bd7d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-10use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-30ofz#46070 Out-of-memoryCaolán McNamara
Change-Id: I35bef5643d8a620aaa001bb1f4f7a9a60779ed97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132288 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-29tdf#147906 change sqrt(a * a + b * b) occurences to std::hypot(a, b)Bartosz Kosiorek
Change-Id: Ic84899bf34f98382e6cc1ffc14310b1667279ee2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132214 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-21ofz#45878 add a way to set some limit on hugely complex clipsCaolán McNamara
Change-Id: I6bbf7c6068560e3bb656560fb5c6cc2ed72cecd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131907 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-18tdf#147906 used std::hypot for Pythagorean additionGautham Krishnan
Change-Id: I9bf10374af93cd22e429a112937aaa8828126523 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131504 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-03-15Update basegfx workbenchHossein
* Update Makefile + Remove obsolete 'test' rule + Fix include * Add needed headers, std:: where needed * Add newlines in the print One can run the workbench simply by invoking: make inside 'basegfx/source/workbench' and then ./bezierclip Change-Id: I1055260a801d3a95c102a92004874000efb6871c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126903 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-03-11new loplugin:trivialdestructorNoel Grandin
look for potentially trivial destructors that can then be elided Change-Id: I435c251bd4291b5864c20d68f88676faac7c43fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131318 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-15tdf#145759 Use symbolic constants instead of magic numerical constantsKunal Pawar
1.4142... -> M_SQRT2 0.4142... -> M_SQRT2 - 1 3.1415... -> M_PI 2.7182... -> M_E Change-Id: If5b19aa38d9902b1a4b717f89f18bdf2f73a47cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129745 Tested-by: Hossein <hossein@libreoffice.org> Reviewed-by: Hossein <hossein@libreoffice.org>
2022-02-06tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroVaibhavMalik4187
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2022-01-19tdf#145614 Convert #define to enum or constexprVaibhavMalik4187
Change-Id: Ib6694ec77c275c9a604abfa7d87df6ab262449b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128250 Tested-by: Hossein <hossein@libreoffice.org> Reviewed-by: Hossein <hossein@libreoffice.org>
2022-01-13Recheck modules [a-c]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I74a3c3a67c3639376e2251c3eb917fa4139dfbd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127808 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-12-27use comphelper::WeakComponentImplHelper in UnoPolyPolygonNoel Grandin
Change-Id: I82248cfbb0cbdb765fa2f97f53e8990a9e05a28b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127547 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-21loplugin:flatten in accessibility..basicNoel Grandin
Change-Id: If2cc282c2b135d634daf393a082c29049b10a677 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127223 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-20Missing inlcude (for std::as_const)Stephan Bergmann
(presumably since 807f238f12e0774fabf507a17ca0ba9204d47833 "Recheck include/[e-r]* with IWYU") Change-Id: I188edd1e9cea0bc2ca65cc834b94aa9c0913c0ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127187 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-07improve loplugin:cow_wrapperNoel Grandin
to find my previous attempt at this, which only obscured the problem <noelgrandin> I'm such an idiot <noelgrandin> I changed a whole bunch of code to avoid calling const methods on a non-const object <noelgrandin> from p->foo() to std::as_const(*p).foo() <noelgrandin> can you spot the mistake? <bubli> Is this a job interview question? :D <vmiklos> noelgrandin: you did the opposite, now you always call const member functions, while you wanted to always call non-const member functions? <noelgrandin> more like a "why didn't the smart people on this channel tell me I was an idiot" :-) <noelgrandin> in this case, we have o3tl::cow_wrapper, which overrides operator* and operator-> <vmiklos> ah, and by the time you would add/remove the const, cow_wrapper already did the expensive task of copying based on const/non-const <noelgrandin> exactly <thorsten> heh Change-Id: I5366e6a87c414b862668b61e6adfbccfdd9d3b04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126473 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03flatten ImplB2DPolygon data a littleNoel Grandin
Change-Id: I64860888bf23a11e8dfaf1fc72132b6fadc526ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126311 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-01improve the script for reducing symbol exportsNoel Grandin
And apply some of the results Change-Id: If555476fdd951cbc1d01fb3ef3ab1cbca2b64960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124896 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-19Drop F_2PIMike Kaganski
Change-Id: Ie98606607b2ce262e4eed76bb8cd86fbfe846f76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125506 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-19Use M_PI* instead of F_PI*Mike Kaganski
Change-Id: Ie2b7a1c74fc516781a17a20157b8217bc41e383d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125504 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-12improve mergeToSinglePolyPolygonNoel Grandin
spotted by llunak. No need to take param by &&, since mergeToSinglePol does not actually need to modify it. Also flatten it a little. Change-Id: I2f5ade347db756e21ecb0a88c3935805268f5072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125086 Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-10-10loplugin:moveparam in basegfxNoel Grandin
Change-Id: I73414e94358114ff0d475f13855db8c4c493b6f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123334 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-06loplugin:moveparam in basegfxNoel Grandin
Change-Id: I68d0de099641ae5b2ae92f46e86bdf4a43c468a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30loplugin:constparams improve handling of pointer paramsNoel Grandin
Change-Id: I4c0002e72703eded435bfe4985f5b0121bf8524b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122843 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15loplugin:constvarsNoel Grandin
Change-Id: I9b35d6333afa6b305bf73fc55a7e60c8365674e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122134 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-13loplugin:cow_wrapperNoel Grandin
check the classes that use o3tl::cow_wrapper so that they don't unnecessarity trigger copies Change-Id: I545e627598217f3e61ba2c384adb8d4f8b404829 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122030 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-08no need to allocate this separatelyNoel Grandin
Change-Id: Ib92bd39d1c5057731d670a79bf788909856247be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121799 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>