Commit graph

429 commits

Author SHA1 Message Date
Stephan Bergmann
16e3b84d2e Improve loplugin:dyncastvisibility to check for non-inline key functions
This would have caught the issue discussed in
709b1f3ddb "Make sure VCLXPopupMenu has unique
RTTI".  (The commit message talks about RTTI there, while what Clang actually
compared for an optimized implementation of a dynamic_cast to a final class is
vtable pointers, but the overall picture remains the same.  Both RTTI and
vtables are emitted along the key function, and if that is missing or inline,
they are emitted for each dynamic library individually, and as internal symbols
on macOS.)

This commit also addresses all the issues found by the improved
loplugin:dyncastvisibility on Linux.  See the newly added TODO in
compilerplugins/clang/dyncastvisibility.cxx and
86b86ac87e "Give DocumentEventHolder (aka
EventHolder<DocumentEvent>) a key function" for an issue with key functions for
class template instantiations.

Change-Id: Ia19155efb1d23692c92b9c97ff17f18ae7a1f3ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176576
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-11-14 12:49:22 +01:00
Noel Grandin
11b1557147 convert KernArray from sal_Int32 to double
which allows us to eliminate a bunch of rounding at various layers, and
consequently maintain a lot more precision

Change-Id: I911dedd7c041c1d67396c082e5695346ea689acb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175814
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-10-31 12:10:52 +01:00
Mike Kaganski
a6a6921123 Use good old string literals in assertXPath and friends
These are only sent to an external API expecting char*-like strings,
or for comparison. Having every assertXPath having three of _[ou]str
is too much syntactic noise, making the unit tests almost unreadable.

Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-10-05 10:06:44 +02:00
Jonathan Clark
3bd4a79772 tdf#119785 Implement the EMF TA_RTLREADING alignment flag
EMF has two ways to indicate that text should be treated as RTL:

- The ExtTextOut ETO_RTLREADING flag
- The SetTextAlign TA_RTLREADING flag

Previously, only the former was implemented. This change implements the
latter.

Change-Id: If1023b4a0a3b6eb2ce47d2b764edbfd1a5c0dd5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173579
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2024-09-18 05:59:51 +02:00
Xisco Fauli
629a9d68ee drawinglayer: getHeight() -> getWidth()
Since 01ded1e6d3
"WMF tdf#55058 tdf#142722 Add implementation of BitBlt and StretchBlt"

Change-Id: Ib99e940c954fe44f2dbee2b14dfa9d2c79468500
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172919
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-09-05 20:06:21 +02:00
Caolán McNamara
a4dfd23e44 cid#1557694 COPY_INSTEAD_OF_MOVE
and

cid#1557162 COPY_INSTEAD_OF_MOVE
cid#1556896 COPY_INSTEAD_OF_MOVE
cid#1556893 COPY_INSTEAD_OF_MOVE
cid#1556873 COPY_INSTEAD_OF_MOVE
cid#1556872 COPY_INSTEAD_OF_MOVE
cid#1556789 COPY_INSTEAD_OF_MOVE
cid#1556570 COPY_INSTEAD_OF_MOVE
cid#1556519 COPY_INSTEAD_OF_MOVE
cid#1556516 COPY_INSTEAD_OF_MOVE
cid#1556451 COPY_INSTEAD_OF_MOVE
cid#1556396 COPY_INSTEAD_OF_MOVE
cid#1556237 COPY_INSTEAD_OF_MOVE
cid#1556113 COPY_INSTEAD_OF_MOVE
cid#1556094 COPY_INSTEAD_OF_MOVE
cid#1555991 COPY_INSTEAD_OF_MOVE
cid#1555982 COPY_INSTEAD_OF_MOVE
cid#1555885 COPY_INSTEAD_OF_MOVE
cid#1555702 COPY_INSTEAD_OF_MOVE
cid#1555610 COPY_INSTEAD_OF_MOVE
cid#1555450 COPY_INSTEAD_OF_MOVE
cid#1555327 COPY_INSTEAD_OF_MOVE
cid#1555145 COPY_INSTEAD_OF_MOVE

Change-Id: I38cc1a38e8cb2c33f33e0fc3afd34a0fb39e5ec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172028
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-19 15:15:54 +02:00
Caolán McNamara
4177e553e0 cid#1555587 COPY_INSTEAD_OF_MOVE
and

cid#1555589 COPY_INSTEAD_OF_MOVE
cid#1555593 COPY_INSTEAD_OF_MOVE
cid#1555596 COPY_INSTEAD_OF_MOVE
cid#1555602 COPY_INSTEAD_OF_MOVE
cid#1555608 COPY_INSTEAD_OF_MOVE
cid#1555610 COPY_INSTEAD_OF_MOVE
cid#1555620 COPY_INSTEAD_OF_MOVE
cid#1555623 COPY_INSTEAD_OF_MOVE
cid#1555625 COPY_INSTEAD_OF_MOVE
cid#1555626 COPY_INSTEAD_OF_MOVE
cid#1555634 COPY_INSTEAD_OF_MOVE
cid#1555638 COPY_INSTEAD_OF_MOVE
cid#1555667 COPY_INSTEAD_OF_MOVE
cid#1555682 COPY_INSTEAD_OF_MOVE
cid#1555686 COPY_INSTEAD_OF_MOVE
cid#1555702 COPY_INSTEAD_OF_MOVE
cid#1555710 COPY_INSTEAD_OF_MOVE
cid#1555750 COPY_INSTEAD_OF_MOVE
cid#1555752 COPY_INSTEAD_OF_MOVE
cid#1555761 COPY_INSTEAD_OF_MOVE
cid#1555762 COPY_INSTEAD_OF_MOVE
cid#1555771 COPY_INSTEAD_OF_MOVE
cid#1555772 COPY_INSTEAD_OF_MOVE
cid#1555784 COPY_INSTEAD_OF_MOVE
cid#1555785 COPY_INSTEAD_OF_MOVE

Change-Id: Ib9724230c05b2027b4edf64e6a0bb5e22a270a88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171274
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-31 17:37:14 +02:00
Noel Grandin
c920881f39 loplugin:ostr in emfio
Change-Id: I3ec70a070fec1e62992eead0405ef689debb9fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167283
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-07 18:15:01 +02:00
Caolán McNamara
84811847cf ofz#68612 Integer-overflow
Change-Id: Ie68a11300f7d2c3667a1d5702cad8e78e6a6c35a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167130
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-05-04 20:29:24 +02:00
Caolán McNamara
248c21867c ofz#68234 emf XForm isnan members
Change-Id: If3d199e764785e1923d40a1b36c388607a5e4326
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166507
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-23 13:20:54 +02:00
Caolán McNamara
7137a52a8d ofz#68172 Integer-overflow
Change-Id: Ie80487e20217d7a54cb401b0423dfec01df1292e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166373
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-20 21:25:13 +02:00
Mike Kaganski
cfa9990d47 Enable this test on all platforms
The original issue that prevented the test on Linux is reproducible.
I didn't debug the cause, so this is just a workaround.

Change-Id: Ifa8fa2a7884adabf797ea2d711f62b6be382dfec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166351
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-20 11:28:25 +02:00
Mike Kaganski
089398e514 Return double from OutputDevice::GetTextArray
And introduce GetTextWidth / GetTextHeight variants returning double.
It allows to avoid premature rounding.

At least in one case - testTdf145111_anchor_in_Fontwork - it allowed
to make the test DPI-independent (at least in my testing on Windows,
using 125, 150, and 175% UI scaling).

Change-Id: I973d2c729ec6bb7114b4f99b9027f1ead7c1d061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166237
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-20 08:53:26 +02:00
Mike Kaganski
690526f95e Generalize basegfx::fround for templated return type
And use it when assigning to tools::Long

Change-Id: I0814d7bac9cdd48191ba69c64e3b12a4973b3417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166071
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-15 06:34:33 +02:00
Mike Kaganski
1f1f423200 Round in XmlWriter::attribute when passing a double
Before, it truncated. Rounding provides a closer value.

Change-Id: I213e6ae34ada2f5081cb2c8b2ef431448c712b37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-14 15:13:10 +02:00
Mike Kaganski
4695d84b78 Use more o3tl::convert
Change-Id: Ia525e051b53dd6082f2f11ff884677c8b8c6a20c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166051
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-13 18:48:38 +02:00
Caolán McNamara
6342aa6c66 cid#1545370 COPY_INSTEAD_OF_MOVE
and

cid#1545364 COPY_INSTEAD_OF_MOVE
cid#1545363 COPY_INSTEAD_OF_MOVE
cid#1545344 COPY_INSTEAD_OF_MOVE
cid#1545299 COPY_INSTEAD_OF_MOVE
cid#1545287 COPY_INSTEAD_OF_MOVE
cid#1545267 COPY_INSTEAD_OF_MOVE
cid#1545256 COPY_INSTEAD_OF_MOVE
cid#1545226 COPY_INSTEAD_OF_MOVE
cid#1545500 COPY_INSTEAD_OF_MOVE
cid#1545538 COPY_INSTEAD_OF_MOVE
cid#1545618 COPY_INSTEAD_OF_MOVE
cid#1545681 COPY_INSTEAD_OF_MOVE
cid#1545750 COPY_INSTEAD_OF_MOVE
cid#1545778 COPY_INSTEAD_OF_MOVE
cid#1545785 COPY_INSTEAD_OF_MOVE
cid#1545799 COPY_INSTEAD_OF_MOVE
cid#1545847 COPY_INSTEAD_OF_MOVE
cid#1545958 COPY_INSTEAD_OF_MOVE
cid#1545963 COPY_INSTEAD_OF_MOVE
cid#1545990 COPY_INSTEAD_OF_MOVE
cid#1546013 COPY_INSTEAD_OF_MOVE
cid#1546029 COPY_INSTEAD_OF_MOVE
cid#1546079 COPY_INSTEAD_OF_MOVE
cid#1546104 COPY_INSTEAD_OF_MOVE
cid#1546127 COPY_INSTEAD_OF_MOVE
cid#1546133 COPY_INSTEAD_OF_MOVE
cid#1546155 COPY_INSTEAD_OF_MOVE
cid#1546190 COPY_INSTEAD_OF_MOVE
cid#1546216 COPY_INSTEAD_OF_MOVE
cid#1546273 COPY_INSTEAD_OF_MOVE
cid#1546315 COPY_INSTEAD_OF_MOVE
cid#1546326 COPY_INSTEAD_OF_MOVE
cid#1546387 COPY_INSTEAD_OF_MOVE

accept some reasonable suggestions

Change-Id: I7b004086d490c7618d8fe7a21a53cfa8ac1f8408
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161748
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-08 13:09:02 +01:00
Mike Kaganski
a01a642ebb UnoApiTest::loadFromURL -> UnoApiTest::loadFromFile
The old name was misleading (it doesn't take an URL, but a filename);
also, now it's easier to grep for it - doesn't get mixed with
vcl::graphic::loadFromURL.

Change-Id: Ib88d2194200a6a54d2326971e0306ba39f0c7025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161578
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-03 07:51:28 +01:00
Caolán McNamara
f0a8b5b81d move IsFuzzing to comphelper
and try something a bit more generic

Change-Id: I1d8256576cd02f0a589df350ba7b53059dd586a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161250
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-30 12:45:45 +01:00
Julien Nabet
88f9b3f16b Use emplace_back instead of push_back (emfio)
Change-Id: I23bd626973c9aa0b4a961b16d5817d58c5f0cf7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161188
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-22 18:12:14 +01:00
Noel Grandin
a214ac6774 simplify and modernise ScopedBitmapAccess
(*) Make all of it use a "Scoped" paradigm
(*) pass by value, no need to allocate on heap
(*) make all of the construction go via the *Access constructors, instead of it being some via the constructors and some via the Acquire*Access methods.
(*) take the Bitmap& by const& in the constructor, so we can avoid doing const_cast in random places.

Change-Id: Ie03a9145c0965980ee8df9a89b8714a425e18f74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-07 09:32:14 +01:00
Stephan Bergmann
7575e8afca loplugin:ostr (macOS)
Change-Id: I1b169e0c170c26a49941d22f0982a24ef547f941
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160391
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-07 07:15:25 +01:00
Stephan Bergmann
e66ccbecfb Extended loplugin:ostr: emfio
Change-Id: Ida43018a83c68f5d20dbee30325b8f32099e5b1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159713
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-20 08:25:16 +01:00
Caolán McNamara
c2d4f89001 cid#1548365 Logically dead code
since:

commit c75cac8523
Date:   Sat Jun 17 02:57:42 2023 +0200

    tdf#155887 WMF Fix displaying images with size of EOF other that 3

Change-Id: I326593cc556319d947bd9f3aef32b4ff6264c68f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158731
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-31 21:20:38 +01:00
Bartosz Kosiorek
c75cac8523 tdf#155887 WMF Fix displaying images with size of EOF other that 3
The size of W_META_EOF (record indicates the end of the WMF metafile)
could be different than 3 (e.g. 6).
The MS Office is allowing different sizes of EOF,
and just properly finalizine parsing WMF file, and display its content.

Original bug report:
https://bz.apache.org/ooo/show_bug.cgi?id=42090

Change-Id: I21b72615c7f45fdca145e6240c6451d7d264d238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153204
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-10-29 11:18:33 +01:00
Bartosz Kosiorek
00e02dd832 tdf#155887 Add individual WMF records validation
In previous implementation, there was no proper validation
of the records, by it's size.
This commit adds validation of the WMF records.

It would allow to interrupt reading, if wrong record found
and play only records until it it correct.

It will allow to mimic the behaviour of MS Office:
If the wrong record is detected, the image is displayed till the wrong record.

Currently in LibreOffice, if wrong record is found whole read is interrupted.

Change-Id: I0c82deabcec7a416ca44540e693822f1986437eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153351
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-10-28 11:06:40 +02:00
Stephan Bergmann
e0c33ec15f loplugin:ostr: automatic rewrite
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2023-10-07 00:47:20 +02:00
Ilmari Lauhakangas
b693d19884 xmltesttools: add assertXPathDoubleValue that takes a double with delta
and use it to make WmfTest::testSetTextAlignWmf independent of DPI

Change-Id: I2048239088a8dcc3e3ab1db96413894b5bcc56d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157377
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-10-06 12:48:17 +02:00
Noel Grandin
b438f10910 XEmfParser does not need to implement XAggreggation
Checked on jenkins using 'make check' and

+    void SAL_CALL setDelegator(css::uno::Reference<css::uno::XInterface> const &) final { assert(false); }
+

Change-Id: I5ff6b1e166aff1ad67464785cf39d748f5dfc236
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156700
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-08 20:20:20 +02:00
Noel Grandin
c1d690d8c4 use sal_uInt64 when dealing with stream position
Change-Id: I34a8ec2f69d9d58f8847e9cfb45937eae6159590
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155528
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-09 22:34:16 +02:00
Khaled Hosny
4b743de97f tdf#156234: Don’t round glyph coordinates when doing subpixel positioning
When doing subpixel positioning (i.e. OutputDevice is in map mode),
delay the rounding of the glyph coordinates after converting from pixel
to logical units to minimize the loss of precision as much as possible.

Some test expectations, expectedly, changes due to the improved
positioning precision.

Change-Id: I2591e3c7d4923ba7886a35bf53db759273354e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154292
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-23 06:01:56 +02:00
Noel Grandin
1f2ff4a0a3 loplugin:redundantcast small improvement
Change-Id: I2c96b367138b94d6178a3c4a0f83049f13a04f82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154679
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-21 11:05:05 +02:00
Bartosz Kosiorek
cbb215aa20 tdf#143877 Fix failing tests caused by floating point precision
Due to different imlementation of floating-point unit (FPU),
on different CPU platforms, the floating point numbers could
could be different.
https://stackoverflow.com/questions/64036879/differing-floating-point-calculation-results-between-x86-64-and-armv8-2-a
https://mcuoneclipse.com/2019/03/29/be-aware-floating-point-operations-on-arm-cortex-m4f/

With this path I have changed the tested images,
to use floating point numbers which are easily represented
by floating numbers (multiplied/divided by 2), like:
 - change tension to values: 0.125, 0.25, 0.5, 1.0, 1.5 ...
 - change position of curve to of control points to 256.0, 384.0 512.0

Previous values was hard to represent by floating numbers,
for example tension:
- 0.4 has been written as 0.399999976158142
- 0.1 has been written as 0.099999994039535

More information:
https://observablehq.com/@benaubin/floating-point

Additionally the precision of numbers were
increased to double.

Change-Id: I5725c1f2f474d0c00821edaa9bb2102cb172093f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152838
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-06-13 12:59:33 +02:00
Bartosz Kosiorek
0b5c0d9e9d tdf#143877 EMF+ Implement EmfPlusDrawCurve with cardinal spline
Change-Id: I98d30b2a8ba63fdddc08668f453c5f0feeb452db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152288
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-06-01 21:17:06 +02:00
Caolán McNamara
d2756dbd9b ofz#58991 Heap-buffer-overflow
Change-Id: I44661cb2f9b2f44118140ae2fbcf86fe12cd282c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151760
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-05-15 12:20:15 +02:00
Caolán McNamara
16941a925c ofz#58928 Heap-buffer-overflow READ
since:

commit ba0bf0ab2c
Date:   Mon Mar 21 20:20:02 2022 +0100

    tdf#142249 EMF Implement EMR_POLYDRAW record

Change-Id: I9234a66d9f8691b9b051950b818884429b5f7277
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151728
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-13 21:05:16 +02:00
Bartosz Kosiorek
717bdd06a7 EMF Fix text aligning for EMR_SETTEXTALIGN for wrong values.
Change-Id: I4d67eb7112d2295185905eac52ebab022a1beb78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151670
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-05-12 22:42:00 +02:00
Caolán McNamara
a9c14a3b2c Related: ofz#58830 do Bezier point count check
Change-Id: I1a7d7600563b57fb6dd9479b288d6fd3d4483059
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151710
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-12 19:30:27 +02:00
Caolán McNamara
2f4e74318a ofz#58830 Container-overflow READ 1
Change-Id: I7786a63c4cad8e4538b108a06551ff274a0ddcc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151658
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-11 13:04:12 +02:00
Caolán McNamara
662840c33d ofz#58836 Out-of-memory
Change-Id: I792bb179d2ac0133175e2690df6731fcb8bbbc15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151659
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-11 11:40:57 +02:00
Bartosz Kosiorek
ba0bf0ab2c tdf#142249 EMF Implement EMR_POLYDRAW record
The EMR_POLYDRAW record specifies a set of line segments and Bezier curves.

Change-Id: I93d846d2fbb7a60b0565668a17ee092da30ef21c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151424
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-05-10 16:45:47 +02:00
Bartosz Kosiorek
ce008fa9d8 tdf#154789 EMF+ Performance boost of the EmfPlusRecordTypeDrawBeziers
There is several benefits of such performance optimization:
 1. We are drawing single curve instead of hundreds of small curves.
    In the loop we are creating single Polygon and outside
    of the loop we are invoking EMFPPlusDrawPolygon drawing method only
    once. As https://bugs.documentfoundation.org/attachment.cgi?id=186725
    image is using single EmfPlusRecordTypeDrawBeziers EMF+ record with
    hundreds of curves, with using single EMFPPlusDrawPolygon call,
    there is no lnger need for individual line creation (e.g. line
    color, weight, line caps, line joints, line dashes, etc.)

    - The PDF export performance without optimizations of the https://bugs.documentfoundation.org/attachment.cgi?id=186725:

        time ./instdir/program/soffice --headless --convert-to "pdf:writer_pdf_Export" --outdir ~ ~/Pobrane/problem.docx
        real 24m18,471s
        user 2m56,004s
        sys 1m37,816

    - The PDF export performance with optimizations:

        real 0m37,527s
        user 0m37,004s
        sys 0m0,531s

    - With Libreoffice 7.5.2 from Ubuntu 22.04, the conversion was
    crashed.

 2. The PDF export for document: https://bugs.documentfoundation.org/attachment.cgi?id=186725
    was not working correctly for me. The original image is containing
    chart. Without optimization, the exported chart was empty.
    Current export is working correctly, and graph is visible.

 3. The standard opening of the document from https://bugs.documentfoundation.org/attachment.cgi?id=186725
    is now much faster. The zooming in, move image operations are also
    noticible faster.

Change-Id: Ic77d4c20a462587bb5da4a4df757e30c5ca04fc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150821
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-04-23 17:42:21 +02:00
Xisco Fauli
ee77462276 CppunitTest_emfio_emf: use CPPUNIT_TEST_FIXTURE()
This suite is large enough so that avoiding the
declaration/registration/definition of each test manually saves a lot of
space.

Change-Id: I476b58a1c45ed5c977ce71a92d172b7e2df93015
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150224
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-04-11 14:30:30 +02:00
Uday Sharma
0d8d0fb893 tdf#143148: Use pragma once instead of include guards
Change-Id: I6898acbf7c6c9de45bbfa6a32202acf302f92caa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146822
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-03-16 09:25:32 +00:00
Stephan Bergmann
a5c83673ba Demultiplex test code
It is so much easier to work with if a test failure's line number unambiguously
points at the code's sole execution.  (That is, test code is necessarily non-
DRY.)

Change-Id: I75919c55671348f6190e9e108e72e24ec18ce986
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148514
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-09 07:06:05 +00:00
Stephan Bergmann
f194f9dba0 Re-enable CppunitTest_emfio_wmf for --enable-mergelibs
It had originally been disabled by a037f6338c
"Disable CppunitTest_vcl_wmf_test under --enable-merglibs for now" because "the
problems caused by that test having the vcl objects linked into both the test's
library and the mergedlib (which the test's library links against) are just not
manageable", which is no longer an issue at least since
29cdfa3fc3 "no need to statically link against the
emfio library in the tests".

But the test code apparently uses WinMtfFontStyle, which can thus no longer be
hidden under --enable-mergelibs.

Change-Id: Ie807b19f0cb44408c69d03faca01fabe88239ca0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148493
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-09 07:05:04 +00:00
Caolán McNamara
199a34194d ofz: Use-of-uninitialized-value
since:

commit bbdbe8ea2e
Date:   Fri Feb 3 22:55:54 2023 +0100

    tdf#142018 Properly create Pen width if style is COSMETIC

Change-Id: I739932e7bbf427a72bf16a771c20b6bd5596da5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147041
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-15 12:28:27 +00:00
Bartosz Kosiorek
bbdbe8ea2e tdf#142018 Properly create Pen width if style is COSMETIC
Change-Id: I6453058c4af352a3b0e14cbccbc1a67c73cd1426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146551
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2023-02-11 21:24:18 +00:00
Noel Grandin
21734247d5 drop internal support for 1-bit images
on modern hardware, these are less efficient than regular alpha
channels.

Also, this greatly simplies the range of stuff that vcl needs to deal
with, which will make the upcoming transparency->alpha patch easier to
deal with.

Enhance vcl::CreateFromData to convert incoming 1-bit data to 8-bit
image.

Change-Id: I35829da750029fe373d0d2911a669d10bab6ad23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145321
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-12 06:52:42 +00:00
Paris Oplopoios
75093a9f7f tdf#152435 Revert "Make EMR_SAVEDC not UpdateClipRegion"
This reverts commit 1230b88055.

Reason for revert:
The reverted commit breaks the files documented in tdf#152435 (some
text is not shown in those .EMF files). The reverted commit would solve
an issue where some text was not clipped correctly, albeit in a naive
way. As it is more important that text is shown rather than some text
having correct clipping, that patch is reverted and I will look for one
that fixes both cases.

Change-Id: I42e85b802b8bf1e77e96f0016cd1d83201047032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143970
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-13 06:59:06 +00:00