Commit Graph
614 Commits
Author SHA1 Message Date
Leonid Ryzhov 1b44a4c558 tdf#147906 Use std::hypot for Pythagorean addition
Change-Id: Ia325af8d9a23e617eb62e6cecab0aa68f1d206f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145089
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-09 09:18:12 +00:00
Caolán McNamara f017eaf5d6 ofz#53450 Integer-overflow
Change-Id: Iccabfb8991a4dca6ec05565f01f6cff82c642d27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142934
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-18 14:54:35 +01:00
Caolán McNamara c2fc5d4fc0 ofz#53450 Integer-overflow
Change-Id: I106e703714083631c67d7b8a84180c3c485953d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142814
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-17 10:31:21 +01:00
Andrea Gelmini 517d05dbfd Fix typos
Change-Id: Ic1fb0ea483954f2994a87e05f33b320da3795227
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142661
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-11-13 22:21:58 +01:00
Noel Grandin b9ec72ff4d add some more asserts in Fraction::MakeFraction
which I missed when inlining code in

    commit 8ac4dd510bd5f41882db0b647797674b06339f4e
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Thu Oct 27 08:48:25 2022 +0200
    tdf#123419 optimise ImplMakeFraction

Change-Id: Ifd271ce89cea29a22d41b8e143e27df118f8df3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141906
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27 15:24:35 +02:00
Noel Grandin eeaac9cfde rational_ReduceInaccurate unnecessary here
as pointed out by mike kaganski, since we are already dealing with
32-bit values

Change-Id: Ic621757f2d9a689e54c47f36cc6ba85a322c500e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141904
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27 13:39:53 +02:00
Noel Grandin 551e5943d4 tdf#123419 optimise ImplMakeFraction
which is very hot here. Push it down into Fraction, where we can skip
the construction of boost::rational intermediate values

Change-Id: I7e5f18456a252a159d3a50e9297168e5ba9e1588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141894
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27 10:58:04 +02:00
Caolán McNamara f59911c438 ofz#52191 Integer-overflow
Change-Id: I97daf9327c55229fe7da546164d398353e0696a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141046
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-10-07 15:49:16 +02:00
Caolán McNamara 70e0b2ab2c ofz#50761 Integer-overflow
Change-Id: I8681e7b1b128e7ca33142b7120ad2d4bb3227493
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139019
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-30 11:52:00 +02:00
Chris Sherlock 59210b075b tools: rename Rectangle::Justify() to Rectangle::Normalize()
Jusify() normalizes the rectangle so both the Width and Height are
positive, without changing the location of the rectangle. It ensures
that the x and y coordinates will be moved to the top left of the
rectangle.

The name is strange, so renaming Justify() to Normalize().

Change-Id: Idbf163e65e52a798e38f785b8961b8042cf0cf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137379
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-24 10:55:15 +02:00
ehsan 9b5f0234da tdf#145614 Convert #define to constexpr
Change-Id: If783e2fbb65cae8e9c79ad9718f344dedf9dfe4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135074
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2022-08-13 12:09:17 +02:00
Chris Sherlock fd9763cb7e tools: prefix member variables with an 'm'
Also updated debug pretty-printers

Change-Id: I5204bb8f1c6a47677ad3c49d6579c090ea69aedc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137388
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-08-09 10:51:53 +02:00
Chris Sherlock 934985becc tools: rename getHeight/Width() to GetOpenHeight/Width()
By default Rectangle uses closed interval, if we really want to use half
open intervals then we should specifically say as such in the name.

Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-11 11:06:53 +02:00
Jan-Marek Glogowski 80d801cf07 Rectangle: split SetSize into SetWidth/SetHeight
... and inline the functions.

Change-Id: I9285c72e8524f8f0a2d242bfd4cd29edf6d1ed73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135811
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2022-06-17 20:41:28 +02:00
Stephan Bergmann 4e7f7a799e This condition is apparently fatal
...as mnPoints is the size of mxPointAry (see also
323df76698 "Revert 'tdf#147919 PPTX export: fix
curved and bent connector shape'")

Change-Id: I10b9c6bd25bc88754d2d52e851c3871621b0d517
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133980
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-07 17:23:53 +02:00
Noel Grandin 4149201b09 use more string_view in tools::Color
Change-Id: I0203aff3af19d3994af5325538520469ab2900ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133541
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-28 16:08:03 +02:00
Noel Grandin 05e75d86db use more string_view in tools
Change-Id: I15ca12f35a66994cb90a0ccf60a1ce0f8efcfecc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133459
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-27 14:02:16 +02:00
Noel Grandin 5fe702f1b6 add o3tl::toUInt32
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26 19:37:20 +02:00
Luboš Luňák 3361db2179 include OutputDevice MapMode in SalLayoutGlyphsCache key (tdf#148400)
The mapmode also affects the layout of the glyphs.

Change-Id: I9492bc4d3d9e991ef8ab5dc30ce424e44cbc79f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132822
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-12 13:31:09 +02:00
Gabor Kelemen 52ef78f492 Recheck modules t* with IWYU
See tdf#42949 for motivation

Change-Id: I109fa07d52721fd10354de07a2ed995ffa2f27c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132369
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-04-02 23:32:08 +02:00
Caolán McNamara 841788923c ofz#45527 detect too many points earlier
Change-Id: I7716ca8b9de9312bcaabf1d16e60dbac7ae87e52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131492
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-13 14:51:53 +01:00
Caolán McNamara f7151c8ab4 pass reference to the target vector instead
no logic change intended here

Change-Id: I680914a6a41cceab41f68456e98de5f3b4a8a639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131491
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-13 14:51:40 +01:00
Bartosz Kosiorek 7b28920382 tdf#113066 tdf#142204 EMF Implement SETARCDIRECTION
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-10 21:19:59 +01:00
Caolán McNamara 80d99a387f ofz: Use-of-uninitialized-value
Change-Id: If75e11dc26aae51d658dddd464135dd8a4f965ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131054
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-05 14:51:31 +01:00
Caolán McNamara 297f000c49 cid#1497939 Division or modulo by zero
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>
2022-02-03 15:54:51 +01:00
Miklos Vajna 8662293d17 tools Color: implement MSO-style luminance modulation/offset filter
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-29 09:51:16 +01:00
Noel Grandin 05766922e7 speed up Fraction::operator*= a little
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-26 17:30:10 +01:00
Mike Kaganski bc0ab08634 Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversions
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-19 15:42:03 +01:00
Mike Kaganski 1cc6fca492 Drop F_2PI
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-19 10:00:02 +01:00
Mike Kaganski 37429f2690 Use M_PI* instead of F_PI*
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-19 09:59:43 +01:00
Tor Lillqvist 9dd38a0b40 Let's assume this is a bogus warning
Change-Id: I3941d8b1811d34b2b7646b20bc7e91c9034770be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124427
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-10-29 16:14:41 +02:00
Luboš Luňák b22d478531 clean up ambiguous confusing rectangle APIs like IsInside()
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-20 12:10:44 +02:00
Luboš Luňák e92fc5ec08 ensure that some basic geometry classes are trivially copyable
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-17 08:50:35 +02:00
Noel Grandin f2315daf70 Revert "speedup rational_FromDouble"
This reverts commit 67d83e40e2.

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-16 13:33:55 +02:00
Mike Kaganski 6419ecb40a No need to check if nDX is 0 for atan2
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 fd2cf3dc7c.

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-15 16:54:19 +02:00
Noel Grandin f8cf0d2cb4 tdf#144319 fix formula load
regression from
    commit 67d83e40e2
    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-06 20:51:48 +02:00
Noel Grandin 03d8a92091 clang-tidy:readability-redundant-member-init
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-09-06 09:04:17 +02:00
Mike Kaganski 6fd0d2af50 Rename SaturatingSet[XY] to SaturatingSetPos[XY]
... to align with commit 4639ca2f87

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-17 13:15:54 +02:00
Mike Kaganski 28708b5b7a Simplify and inline tools::Rectangle::Justify
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-17 11:24:46 +02:00
Mike Kaganski 4639ca2f87 Rename setX/setY to SetPosX/SetPosY, to align with SetPos
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-16 20:09:43 +02:00
Mike Kaganski 581b2cf796 Drop tools::Rectangle::getX/getY, which are just duplicates of Left/Top
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-16 15:53:02 +02:00
Mike Kaganski 6c12c659fb Simplify tools::Rectangle a bit
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-15 10:18:49 +02:00
Mike Kaganski 5351e837a1 Unify and simplify tools::Rectangle methods returning Point
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-12 04:48:48 +02:00
Noel Grandin 417f881d20 improve LOK notifyInvalidation
(*) 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-08-05 22:20:13 +02:00
Caolán McNamara 2a1725fbc2 ofz#35504 promote to double earlier
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-29 12:13:33 +02:00
Caolán McNamara 228cb26a6a ofz#35504 Integer-overflow
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-28 09:53:10 +02:00
Caolán McNamara 623b633f11 ofz#35504 Integer-overflow
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-23 17:48:37 +02:00
Caolán McNamara 6a1dea1d7a Revert "ofz#33769 Integer-overflow"
now fixed at an earlier stage so NaN isn't imported from dxf

This reverts commit 71fe0aeee2.

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-20 16:27:08 +02:00
Caolán McNamara 71fe0aeee2 ofz#33769 Integer-overflow
Change-Id: I2f158b1f7c3fdaea00c4334cf3889e0f38674e8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116650
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-03 13:37:36 +02:00
Noel Grandin 3e0c39f9ae no need to allocate these on the heap
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-28 13:28:31 +02:00