summaryrefslogtreecommitdiff
path: root/basegfx
AgeCommit message (Collapse)Author
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>
2021-08-27clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: Ibeff6e5cbc20ab86b1e9cb96292acb340849ede3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121149 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-22no need to use unique_ptr for B2DPolygonNoel Grandin
it is already a COW type Change-Id: I86c4be9dd83b98eedf169c3b6668a7994204bca0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120827 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-18loplugin:sequenceloop also check for B2DPolyPolygonNoel Grandin
which has the same problem Change-Id: I98f9924626f26739e91d6a9d21e4276473ea314d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-17reduce alloc costs for some basegfx objects (tdf#105575)Noel Grandin
we can use a default object for the default constructo case, and remove one malloc for each default constructed object Change-Id: I0bec37ef9161a210973abb25669a9f16a5e0ea75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120603 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-31getArray->getConstArrayNoel Grandin
Change-Id: I951dd4a02c9ead98e7eb13ae2995ba2e1e57b38a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119740 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-27Drop redundant checkMike Kaganski
If value is not approximately equal to zero, its square root also is not Change-Id: I0a2c30a8a85c64406e3a8ea8cff2315f25c2226d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119444 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-28loplugin:indentation improve checks for brace alignmentNoel Grandin
Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-17basegfx: generalise tuples with template class Tuple2D and Tuple3DTomaž Vajngerl
B2DTuple2D, B2ITuple2D and B2I64Tuple share a lot in common so we can generalise it as a template class. The same goes for the 3D variants - B3DTuple and B3ITuple. This is the initial attempt, but doesn't yet generalise all that is possible. Add some tests for the tuple variants that test the behaviour of overloaded operators and other common methods. Change-Id: Iee5ed15d58ea88e65ee7854bd05a87ceab22023d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117104 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-06-16basegfx: use namespace for "ftools", make sure input is FP numberTomaž Vajngerl
Don't use empty class with static methods for ftools, but just use namespace instead. Also make sure it works with any floating point numbers (float and double) and don't allow input if it is anything else than a floating point number Change-Id: I94b964291b3999d38ae13afe6ddfdbe6d891d410 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117154 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>