summaryrefslogtreecommitdiff
path: root/tools/source/generic
AgeCommit message (Collapse)Author
2022-03-10tdf#113066 tdf#142204 EMF Implement SETARCDIRECTIONBartosz Kosiorek
Change-Id: I30206c68ecf1829ba0094e6259b8ed7dc05f2e9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131103 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2022-03-05ofz: Use-of-uninitialized-valueCaolán McNamara
Change-Id: If75e11dc26aae51d658dddd464135dd8a4f965ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131054 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-03cid#1497939 Division or modulo by zeroCaolán McNamara
and cid#1497937 Division or modulo by zero Change-Id: I24f939e19791d811845a476c68125f40bb78f9c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129400 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-11-29tools Color: implement MSO-style luminance modulation/offset filterMiklos Vajna
To be used when a filtered theme color will be applied on the UI, and not at PPTX import time. Change-Id: Ifb56e38e59b529ef436063c407ee156d76a77f9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126011 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-26speed up Fraction::operator*= a littleNoel Grandin
for my test spreadsheet this reduced the time spent in Fraction by 30% Change-Id: Ib14a93284dbd6c6ea2349c1754979135463ca61b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125878 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-19Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversionsMike Kaganski
Change-Id: Ib89b00c3dc8cd440e8a88906eea133becd1cef64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125509 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
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-10-29Let's assume this is a bogus warningTor Lillqvist
Change-Id: I3941d8b1811d34b2b7646b20bc7e91c9034770be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124427 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-09-17ensure that some basic geometry classes are trivially copyableLuboš Luňák
They in practice are, since they are just integers, but SwRect had explicit implementations of some functions that technically prevented SwRect from being considered trivially copyable, even though they were identical to default implementations. Change-Id: Ib5086dcd5279f3b4c0c530535c91524671cc6656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122213 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-16Revert "speedup rational_FromDouble"Noel Grandin
This reverts commit 67d83e40e2c4f3862c50e6abeabfc24a75119fc8. because it causes less accuracy sometimes, eg. see https://gerrit.libreoffice.org/c/core/+/122186 Change-Id: I06eb4921359a8fe6689c6cfd3e2967e25b646fa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15No need to check if nDX is 0 for atan2Mike Kaganski
We rely on IEEE floating-point arithmetic anyway, and then even both arguments equal to 0 do not result in an error. Even if it was different, it would be better to check id both nDX and nDY are 0, and return 0 early. It was so ever since "MWS_SRX644: migrate branch mws_srx644 -> HEAD" commit fd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135. Change-Id: I5b8e2a359374dd1500b149d74eba4c0b0e5cd8d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122115 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-06tdf#144319 fix formula loadNoel Grandin
regression from commit 67d83e40e2c4f3862c50e6abeabfc24a75119fc8 Author: Noel Grandin <noelgrandin@gmail.com> Date: Sat Dec 19 13:25:53 2020 +0200 speedup rational_FromDouble Change-Id: Icb728b63f950e827f1492087114f927c2f85ddb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121719 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-06clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: I8590d67f064dd74da42c0e3bf543f2aadbd2b893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121693 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-17Rename SaturatingSet[XY] to SaturatingSetPos[XY]Mike Kaganski
... to align with commit 4639ca2f878b04ffc50d9c20d92e90464d2d67a7 Change-Id: Ibec7a451a61ca7f2d141a9624369a6f9656ed468 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120562 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-17Simplify and inline tools::Rectangle::JustifyMike Kaganski
Change-Id: I535fb70fa532d98542ac30e0b2053bdaa6b94383 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120494 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-16Rename setX/setY to SetPosX/SetPosY, to align with SetPosMike Kaganski
Change-Id: I856194f26fefad993f416d7b92b57a9417a3c0a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120546 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-16Drop tools::Rectangle::getX/getY, which are just duplicates of Left/TopMike Kaganski
The change allowed to simplify many places where previously this API was used, to avoid inefficient calculations (e.g., moving rectangle keeping its size, and then immediately changing the size). Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-15Simplify tools::Rectangle a bitMike Kaganski
1. Simplify/delegate ctors 2. Simplify getWidth/getHeight 3. Simplify expand 4. Simplify operators += / -= / + / - Change-Id: I023aa1bb2905394fbbd29adc7c544d629f9ae2d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120476 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-12Unify and simplify tools::Rectangle methods returning PointMike Kaganski
Make the methods use Left()/Top()/Right()/Bottom(), allowing to avoid explicit checks for emptiness. Also do not use std::min/max in *Center(), so that e.g. TopCenter returns top value the same way as TopLeft and TopRight do. Change-Id: Ie1edd7a0ab7e32b4f98d0c2fb3917ce2902bdf7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120353 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-05improve LOK notifyInvalidationNoel Grandin
(*) tweak buffer in SfxLokHelper::notifyInvalidation to be a bit larger, so we avoid the cost of a resize&copy (*) use our optimised OString concatentation instead of going via std::stringstream (*) pass down a pointer to rectangle, instead of a string. later we will use this to avoid doing the stringify until later Change-Id: Ia3e3042bc919d9b9cb80e47a93704eb236438605 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119994 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120072 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-29ofz#35504 promote to double earlierCaolán McNamara
Change-Id: I20906d61f411bba5b37f7248ba9b544afa27a0a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118051 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-28ofz#35504 Integer-overflowCaolán McNamara
Change-Id: I7a462b821f286411d759b5259461fcdbf1741859 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117955 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-23ofz#35504 Integer-overflowCaolán McNamara
Change-Id: If8c460a4890ad23c2656c3b677b6c2ad8d46fb2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117734 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-20Revert "ofz#33769 Integer-overflow"Caolán McNamara
now fixed at an earlier stage so NaN isn't imported from dxf This reverts commit 71fe0aeee20640c57816dc45010d32dac9afeaaf. Change-Id: Id2689e33f89deb08e1bcd39a6d4ba38fb4663681 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117511 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-03ofz#33769 Integer-overflowCaolán McNamara
Change-Id: I2f158b1f7c3fdaea00c4334cf3889e0f38674e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116650 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-28no need to allocate these on the heapNoel Grandin
Change-Id: I0f477edb666ff2c6dc9def45ec68c4ce1a34634a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116289 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-21tdf#55007 tdf#142263 tdf#142268 EMF ARC, PIE, CHORD allow to draw circleBartosz Kosiorek
In Metafile specification, if Start Point is the same as End Point, then the full circle should be drawn. Unfortunately with previous implementation, if Start Point is the same as End Point, nothing is drawn. This patch fixes that and removed EDGES optimizations, which causes display issues. Change-Id: I16a1b98f10378d57bed59696db6cc9f228044292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115891 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2021-05-20Simplify a bit: use one minmax in place of 3 min + 3 max callsMike Kaganski
Change-Id: Ief2d8d049d2e05ee762e6855514f75be2f053836 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115835 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-18tdf#55007 tdf#142263 tdf#142268 EMF Properly display ARC and CHORDBartosz Kosiorek
With previous implementation the ARC, ARCTO and CHORD were not displayed if the corners of rectangle was switched. With this patch the shapes are always displayed correctly. Change-Id: Ie8ac7af812298c0b96c3b5af417117784f128ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115757 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2021-05-03loplugin:unnecessaryparen small improvementNoel Grandin
when calling a function, and passing only one arg, but the function has defaulted args, we were ignoring this case. Change-Id: I86517f18e30531127664088ddc09ef96dbd8bdf5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-28ofz#33769 Integer-overflowCaolán McNamara
Change-Id: I067db0452650cf3e8bc887abac74c4ff796d4ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114768 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-27loplugin:moveoptNoel Grandin
An attempt that did not find anything convincing enough to finish it up and make it permanently active. So just leave it in /store for now. Change-Id: I1750e177655a4a510da100f880ba81bf762be277 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114742 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-19use more string_view in OString APINoel Grandin
some parts of the OString seem to have fallen behind its more popular sibling OUString. Change-Id: Ie6d64c3005b2df5da49ba79d0c38282dd5057a23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-14ofz#33235 Integer-overflowCaolán McNamara
Change-Id: I7a717a5bfdd58f22de3dcd61fe4aad67d1463a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114099 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-10ofz#32973 Integer-overflowCaolán McNamara
Change-Id: Ib290468b4c7388b80da627138435b98feaed354b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113921 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-09ofz#33038 Floating-point-exceptionCaolán McNamara
Change-Id: Ibe4a6667f5a14b5d94f2dbb92ad611ecba4984f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113821 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-07ofz#32965 move fpe fix of ofz#17212 into toRationalCaolán McNamara
Change-Id: Ica301357f45fd289c41234b8a7059ab0ff264321 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113703 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-05Use std::gcd instead of boost versionMike Kaganski
Change-Id: Iba3bd7cbab01a99f46e7b2f5632fd3b11e70458d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113598 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-05ofz#32885 regard as invalid fractions that will FPE boost::integer::gcdCaolán McNamara
Change-Id: I59befe0cd21be54d1c94bb28e3d9c01f1483c104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113574 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-02vcl: move Fraction reading/writing to GenericTypeSerializerTomaž Vajngerl
Change-Id: Iccacaa7fd9cffe1d99f76def854c2150bb4d94f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113499 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-15cid#1471704 workaroundNoel Grandin
Coverity complaints that "nVal = nNum[0] in bigint.cxx:84 is an assignment of overlapping memory" But this is essentially a tagged union, so it's actually fine. Workaround the warning by using a temporary (which the compiler will optimise away anyhow) Change-Id: I0fda945f831b1cdd7b33f7cb671a744150990bf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109294 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-14cid#1471346 Uncaught exceptionCaolán McNamara
Change-Id: I535affd6597636aa32e1cf9c6005238f9503ef6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109266 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-06bIsBig member is redundantNoel Grandin
we can just use nLen != 0 to get the same information Change-Id: I2406322aa8b7cfc5e276818df763c6de08397454 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108834 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-06move the bigint based Scale() implementations to one central placeNoel Grandin
Picking the best looking one in the process. Change-Id: I77f9236fcd21f883a23fe2f43f20336f17b44cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108831 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-24Revert "add sal*Int64 conversions to BigInt"Stephan Bergmann
This reverts commit 5dae4238ea6e21df42f4437a43d152954fc494fd, which appears to have ambiguitiy problems not only on Windows, but generally with 32-bit builds like <https://ci.libreoffice.org/job/gerrit_android_x86/1518/>: > /home/tdf/lode/jenkins/workspace/android_x86/tools/source/generic/bigint.cxx:501:18: error: conversion from 'int' to 'const BigInt' is ambiguous > *this *= 10; > ^~ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:58:5: note: candidate constructor > BigInt(sal_Int32 nValue) > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:66:5: note: candidate constructor > BigInt( double nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:67:5: note: candidate constructor > BigInt( sal_uInt32 nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:68:5: note: candidate constructor > BigInt( sal_Int64 nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:69:5: note: candidate constructor > BigInt( sal_uInt64 nVal ); > ^ Change-Id: I674b14c342ece3e170185b7ce2f34ccb8ff91c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108186 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-24add sal*Int64 conversions to BigIntNoel Grandin
we have the capability, so lets use it Change-Id: Ie5aa7999bb457d274bbcc07ba5c4e6ee2f286df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108231 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-24custom literal for Degree10Noel Grandin
Change-Id: Id13869138a622e62d9ffebf2c89bddccda6aff01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-20use CLZ intrinsic in tools::FractionNoel Grandin
which commonly maps to a fast hardware instruction. Change-Id: I65d6b4ce03a1813f014aa7ec7fc8f95aa38832d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108018 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>