summaryrefslogtreecommitdiff
path: root/basegfx
AgeCommit message (Collapse)AuthorFilesLines
38 hoursloplugin:stringadd in b*Noel Grandin1-3/+3
after my patch to merge the bufferadd loplugin into stringadd Change-Id: Ieb9b4f5154173738e26b429b55c7a3ea38733553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
4 daysFix typosAndrea Gelmini1-1/+1
Change-Id: Iaf63fce5295f00e5d6fff020498a01a25fc0ee93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149262 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
4 daysMCGR: Model data changes for ColorSteps (II)Armin Le Grand (allotropia)1-39/+37
The biggest change here is to allow multiple ColorStops with the same Offset. That allows to define gradients with 'hard' color changes at any place using two ColorStops with the same Offset and different Colors. This required quite some adaptions, but works well. Also removed in this context checking for all Colors being the same to not mix up things. Also works well. Also changed the need for having Start/EndColors AKA ColorStops for 0.0 and 1.0 in place, instead 'imply' the 1st ColorStop to also define the StartColor and the last one the EndColor. This allows e.g. Gradient definitions with two GradientStops at the same Offset e.g. 0.5 with different colors to already define a full Gradient. Also added a tooling method to reverse ColorSteps, which changes the order and mirrors the Offsets (what even keeps an existing sort valid). This is useful e.g. for GradientAxial which is the only one where for decomposition the Gradient had to be interpreted 'reverse' since it's defined from center to edge, but for creating correct filled polygons to represent this the inverse order had to be used, creating polygons from edge to center. This led to 'wild' code for this one of six cases and prevented unifications with the other cases (also made your brain flip). Thus I adapted this now to use the reversed ColorSteps consequently, and the same principle loops than the other implementations to make things easier for the future and to use common tooling. Change-Id: If2943348d17d5b9cd165f4d78f22638a1dff5237 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149208 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
6 daysMCGR: Model data changes for ColorStepsArmin Le Grand (allotropia)1-43/+148
Added tooling replaceStart/EndColor to allow simple transition for code that does not immediately adapt to multi color gradients. Also added createColorStepsFromStartEndColor for the same purpose. Adapted XGradient to no longer have Start/EndColor at all, but only use ColorSteps. Adapted all usages of XGradient to no longer use Get/Set/Start/EndColor, but access the ColorSteps instead. Replaced quite some XGradient constructors that used XGradient() as Start/EndColor since this is already the default. Adapted ColorBlending to black AKA Start/EndIntens in XGradient to work now on all ColorSteps in the required linearly-scaled manner. UNO API changes: Added com::sun::star::awt::ColorStep as basic data element that holds a pair of Offset and Color. Added com::sun::star::awt::ColorStepSequence to handle an array of sorted entries. Added com::sun::star::awt::Gradient2 derived from com::sun::star::awt::Gradient, extended by the needed com::sun::star::awt::ColorStepSequence. Added MID_GRADIENT_COLORSTEPSEQUENCE to UNO API to provide access to ColorSteps directly. Adapted XFillGradientItem::QueryValue/PutValue to make use of new UNO API data structures. To do so, added tooling methods for data transition: - fillColorStepSequenceFromColorSteps - fillGradient2FromXGradient - fillColorStepsFromAny - fillXGradientFromAny and adapted - case '0' (all data) - MID_FILLGRADIENT - MID_GRADIENT_COLORSTEPSEQUENCE - MID_GRADIENT_START/ENDCOLOR to make use of these. Tested usage of these in the office. Renamed from GradientStep to GradientStop after discussions with members on the list to make this closer related to other norms/definitions. Also renamed classes and class members to better reflect to GradientStop, so grepping/finding will be easier (e.g. 'Color' just exists pretty often, but 'StopColor' is more precise). Changed the used UNO API class for reprsenting the Color to better reflect to ranges [0.0 .. 1.0] and usage of RGB. Change-Id: I1eeb3e97e81d6785967615d1ff256551fc3b882d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148849 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-03-06clang-tidy dead-storeNoel Grandin2-2/+0
Change-Id: I842114880c43dfcc342b6255b7d17befb905bccb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148345 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-05Fix typoAndrea Gelmini1-1/+1
Change-Id: Iddc3e2a28eb638f52a0560925bdeffddb20d3a86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148264 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-05Fix typoAndrea Gelmini1-1/+1
Change-Id: I5b58180d4d048155b927156be1fb6fb22f0e657c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148265 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-04MCGR: ColorSteps handling moved to toolingArmin Le Grand (allotropia)1-0/+115
Due to the fact that handling of a vector GradientSteps will get used more often with ongoing changes I moved some handling to tooling, see sortAndCorrectColorSteps. That method sorts and corrects a vector of ColorSteps so that only valid entreis remain in a sorted order, for details please refer to the docu at function definition. I took the occasion to rearrange that to work on the single provided vector which is better for speed & ressources. Also changed the ColorStep constructor to not automatically correct constructed entries: While that is formally correct, it moves an invalid entry to 0.0 or 1.0, thus creating additional wrong Start/EndColor entries. Those may then 'overlay' the correct entry when corrections are applied to the vector of entries which leads to getting the wanted Start/EndColor to be factically deleted, what is an error. Also rearranged FillGradientAttribute to now work initially with ColorSteps, no longer requires the Start/EndColor, also adapted all usages. This securely allows start/end and in-between single-color sections in gradients. Also needed to re-formulate GradientRect & GradientElliptical ::appendTransformationsAndColors method for correct 2D mapping(s) - always incrementing from the start to end conflicts with the adaption of the start value for the inner loop mainly because increment is at start of inner loop (pre-increment). Corrected errors from clang plugin, but also some wrong initialiations for basegfx::ColorSteps. Change-Id: I292592ed9abcfa591f68a680479f4fcdda46cbeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148196 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-27MCGR: Adapted other Gradient* to make use of MCGRArmin Le Grand (allotropia)1-25/+2
Added to make GeoTexSvxGradientElliptical GeoTexSvxGradientSquare GeoTexSvxGradientRect work using the MCGR. It is still 100% backward-compatible, so as long as there is no source using this it will stay invisible - by purpose. Tests look good with all three, see the static variable nUseGradientSteps. NOTE: GeoTexSvxGradientElliptical still looks not optimal due to texture back-mapping method getEllipticalGradientAlpha, see notes in commit "MCGR: Adapted GradientRadial to make use of MCGR" ac824594c577ab4880177b3411a25297b1d08074 Change-Id: I56b82b867af88fe532f840dde15e0f5c299ed6a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147662 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-24MCGR: Adapted GradientRadial to make use of MCGRArmin Le Grand (allotropia)1-9/+1
Added to make GradientRadial work using the MCGR. It is still 100% backward-compatible, so as long as there is no source using this it will stay invisible - by purpose. Tests look good with this one, see the static variable nUseGradientSteps. Change-Id: Ie7134fe2995b23ceb180c7daf3f5b2310c8a8a78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147617 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-23MCGR: Adapted GradientAxial to make use of MCGRArmin Le Grand (allotropia)1-16/+2
Added to make GradientAxial work using the MCGR as 2nd of six types. This one was complicated since it uses the gradient(s) 'reversed' when you look at it, from outside to inside. Had to do quite some tickeling to get it all work, but looks good now. For modifyBColor I Could re-use the started tooling as planned. To get the reverse usage working I ended up in 1st adapting the previous usage to make more use of std::iterator and reverse_iterator to be able to use the reversed state of the ColorSteps more 'controlled' as if trying to adapt the numerical indices to the vector (that ended in chaos). It is still 100% backward-compatible, so as long as there is no source using this it will stay invisible - by purpose. Tests look good with this one, see the static variable nUseGradientSteps. Change-Id: I0117ec9a24b5e55869b3e2741c67fb87b549db97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147510 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-23avoid div/0 in getCutPointForGivenYNoel Grandin1-0/+3
Change-Id: I8e5e5689ee11777938ca7d0268b8e04e77466734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147496 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-23make B2DPolyPolygonTest deterministicNoel Grandin1-2/+10
Change-Id: Ia8071285d70b39b21b1312d461dc8d502d5cb305 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-22Fix typoAndrea Gelmini1-1/+1
Change-Id: I17aa944a68ac80f67034cc92fca3f7531e0d5385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147475 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-22Fix typoAndrea Gelmini1-1/+1
Change-Id: I9bfdabcb7ba99c9e64dfc36aadfea8f6de02058b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147471 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-22MCGR: Adapted GradientLinear to make use of MCGRArmin Le Grand (allotropia)1-5/+96
Added to make GradientLinear work using the MCGR as 1st of six types. Had to do quite some tickeling to get it all work, but looks good. Five more to go, already started to put some things to tooling to make re-usable for the other types. Besides adapting this the main change is that the adaption of defined step-count (versus automatic) has to be done in modifyBColor now instead of the back-mapping methods (e.g. getLinearGradientAlpha). It is still 100% backward-compatible, so as long as there is no source using this it will stay invisible - by purpose. I started to do quite some tests (and fixes/ adaptions in consequence), see the static variable nUseGradientSteps. If you want to play with this, you might set it to '1' instead of '0' and use a linear gradient on an object. Change-Id: I9d61934defb0674456247f2879f0a89b6a5e50f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147413 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-20Fix typoAndrea Gelmini1-1/+1
Change-Id: I0247eec84ea4c7dc5386bd8bcb9792601758e8c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147317 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-20Fix typoAndrea Gelmini1-1/+1
Change-Id: I34f84c957ba9480a1e8aa17a394e139a7f736050 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147318 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-20MCGR: Correct GradientElliptical & GradientRectArmin Le Grand (allotropia)1-2/+100
The visualizations when using the texturing methods modifyBColor/get*GradientAlpha were both not correct since they did not apply the aspect ratio. I corrected both where GradientRect is correct, but GradientElliptical is close and may have small divergencies. Change-Id: I6bcc07ec7cd4cdeb7863b51b20db3a7dd5afc41c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147218 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-15MCGR: Add GradientSteps to GeoTexSvxGradientArmin Le Grand (allotropia)1-5/+25
Move GradientSteps data to GeoTexSvxGradient and adapt interfaces. Also move tooling to more isolated place in gradienttools in basegfx. Keep everything still compatible, the work will be now to adapt all six different derivations of GeoTexSvxGradient to make use of the evtl. given GradientSteps. Change-Id: Iaa212763c603d46de0a94b1b203b979bb7ce359d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147050 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-08basegfx: restructure B1DRange and B2DRange tests and add use casesTomaž Vajngerl2-33/+62
Change-Id: I423171e886e56a0fa107c58edee7bf8a2259a6fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146600 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-25ofz#54437 TimeoutCaolán McNamara1-1/+1
Change-Id: Ib9b581a5e8b2385300923b2dc5bfaf7cee9c6bb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146146 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-05Revert all the recent loplugin:unocast changesStephan Bergmann2-13/+2
...as obsoleted by ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for dynamic_cast on UNO proxy objects". This reverts all of: 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c "loplugin:unocast (framework::Desktop)" 03efbf72f4ddf7a84aa8aabef348331bd4b75e8a "loplugin:unocast (vclcanvas::TextLayout)" 80099fdd51a69eaa6c36ca88ef772810e4a777fa "loplugin:unocast (SalGtkXWindow)" cc147f576d8687fb79c77d47d41dc4ba1678a469 "loplugin:unocast (sdext::presenter::CachablePresenterView)" 40db42be1d8fd0f9c6c8c5ba3767ddb9ee2034c2 "loplugin:unocast (vclcanvas::CanvasFont)" 2d1e7995eae29e2826449eb5179f5fae181794a5 "loplugin:unocast (CairoColorSpace)" 4c0bbe4bd97636207cf71a6aa120c67698891da9 "loplugin:unocast (canvas::ParametricPolyPolygon)" 89803666621c07d1b1ac9d3bd883f0ca192a91a0 "loplugin:unocast (vclcanas::CanvasBitmap)" d5e0c2c8db71878d21c2a7255af08cf5f9a6dd04 "loplugin:unocast (sfx2::DigitalSignatures)" c0c4519e0d5b555f59bbc04cc616454edfd1f4ce "loplugin:unocast (VCLXAccessibleComponent)" feb8b833a6245d42400f42a0bc789dc84594ee6f "loplugin:unocast (VCLXDialog)" 1fa58cc6cc9c3849753342a5d9a6ddfa461b5e66 "loplugin:unocast (VCLXMultiPage)" f481f036deb1b1b46f3038074c4659f3a91b9c6c "loplugin:unocast (DocumentSettingsSerializer)" 73df933f5fa5932f94e5a1b338a3eda00a9ce354 "loplugin:unocast (css::embed::EmbeddedUpdate)" 420165ab0ef03c0467f9d17f504de2d2fc78f0e6 "loplugin:unocast (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)" 9abe8ee067e6c00f19d8a13346d53c4641c27166 "loplugin:unocast (MutableTreeNode)" 9f3022ceb036f23b4b0994c3e2fbd1001bff225a "loplugin:unocast (VCLXTabPage)" 1be70dda02c12a60778b7607cff2520ae1aa611e "loplugin:unocast (vcl::unotools::VclCanvasBitmap)" d6a70bb641b96e8e5616448c2378131ed62658b4 "loplugin:unocast (basegfx::unotools::UnoPolyPolygon)" 5a14f009e6782c077463c8cbb8e9cea3d7950107 "loplugin:unocast (xmlsecurity::Certificate)" 99009c9535dfa3e0d838989ccc7d84bfa2320ff4 "loplugin:unocast (sd::Annotation)" 0c7585c5fa78887e5459885ed744e8044fd76137 "loplugin:unocast (sd::TextApiObject)" 24e14afd1bfcaed6c200ab081973fba7e47267ca "loplugin:unocast (SignatureVerifierImpl)" 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 "loplugin:unocast (pcr::PropertyEventTranslation)" a97e2d2702d9a6f37775ccee2c08c4f3b2479c4b "loplugin:unocast (RangePageBreaks)" 19dfdf86ad1f5b08041d8b7a9f196caf881231ab "iloplugin:unocast (pcr::OFormattedNumericControl)" f9785ea595fd8e911f6370e836fa579225b9e571 "loplugin:unocast (frm::OInterfaceContainer)" 5e5f40a4a92a31b0932c690219d002fcf18598cf "loplugin:unocast (ScVbaShapes)" 27b35b2c215b4832d4378ec3a7ecbba926552d06 "loplugin:unocast (ScVbaShapeRange)" cb3108f860065928552a86cf8acc4b3a95718ecf "cid#1517812 Dereference null return value" feba0ddb1521d1142560fe54b7d7696ee910237f "loplugin:unocast (weld::TransportAsXWindow)" 4d6c23216559eb48f9943bb49d6e475a6d64ba15 "loplugin:unocast (oox::ForumlaImExportBase)" 4844c096a8ab6a9a620c410a0949d4499f12a504 "loplugin:unocast (cairocanvas::SurfaceProvider)" 9a0b523e0a84d403b9092176ccec4b3e3efe42d0 "loplugin:unocast (cairocanvas::CanvasBitmap)" 8a5648d8e59b4b007dbbf3824777c19a21efc61e "loplugin:unocast (cairocanvas::TextLayout)" 28c27a0623bc78a0590858f97d03b620985bc84c "loplugin:unocast (cairocanvas::CanvasFont)" 53bc223cb3288e32a417696ee61c29e5f01f209d "loplugin:unocast (cairocanvas::RepaintTarget)" 5f70b0b9f6bc4ab145ddbd9155590ed4a3b1b9ec "loplugin:unocast (SvXMLImport)" 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 "loplugin:unocast (VCLXWindow)" 88b4f966202717cd4ad38a30a8eda22c3e69ed35 "loplugin:unocast (sfx2::sidebar::SidebarController)" f1b7a69b280aefe2f1b3b0f32193494fd765f2bd "loplugin:unocast (SvxLineStyleToolBoxControl)" ba76f0ba7e8de4d2953739c952004b7d9af47197 "loplugin:unocast (i18npool::Calendar_gregorian)" 840154daf934d8df52ead1cb7acd798c4d30f007 "loplugin:unocast (framework::AddonsToolBarWrapper)" b0e9c4c5f063cefa9557810e3349bdb9c7493091 "loplugin:unocast (GrammarCheckingIterator)" 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac "loplugin:unocast (ucb::ucp::ext::Content)" 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a "loplugin:unocast (basic::SfxScriptLibraryContainer)" 9e73ff9fce12e102bb3c3cea8d8bb96c88f2c9ad "loplugin:unocast (sdext::presenter::PresenterNotesView)" a98acca8fbc38d3fd5600ae5056a8e42b6d8a40d "loplugin:unocast (SelectionChangeHandler)" c0b59ad6e35b0cb0dea0821e95f95569739078c1 "Consistently use comphelper::getSomethingImpl<I>(aIdentifier, this)" 276e3ccbdd3259ec3daf8a1a98fa7f406b14e21c "loplugin:unocast (vclcanvas::RepaintTarget)" Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-22loplugin:unocast (basegfx::unotools::UnoPolyPolygon)Stephan Bergmann2-2/+13
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I166d8f31a13a98caf0bb7a3b5025a9d942808096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144746 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-21cid#1517814 Calling risky functionCaolán McNamara1-8/+12
Change-Id: I0451ac0375ad5a29a5bf65ebcc028ae44c43d934 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144688 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-20Added BColorModifier_randomize for visualization testingArmin Le Grand (allotropia)1-0/+47
This BColorModifier is able to blend a color against a randomized one, by the given amount. This is useful for testing purposes in th eliving office when making interactive tests with it. Change-Id: I96d8b83397783201080682cd4bd75779ef77b238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144541 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2022-10-30tdf#126788 use singleton to avoid initial allocationNoel Grandin1-1/+4
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 Kaganski1-7/+2
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 Kaganski1-6/+10
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 Kaganski2-0/+11
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 Kaganski2-231/+160
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 Parekh1-5/+1
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ž Vajngerl4-3/+126
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ž Vajngerl2-14/+0
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 Grandin1-1/+1
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 McNamara3-6/+6
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 Grandin2-7/+2
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 Sherlock1-8/+8
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 Grandin2-0/+12
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 Grandin1-10/+5
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 Grandin1-0/+2
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 Grandin1-3/+3
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 Grandin3-6/+9
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ž Vajngerl2-0/+86
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ž Vajngerl1-38/+17
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ž Vajngerl1-3/+3
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ž Vajngerl4-8/+69
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 McNamara1-4/+4
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 Grandin1-1/+1
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 Bergmann1-4/+4
...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>