summaryrefslogtreecommitdiff
path: root/vcl/source/filter
AgeCommit message (Collapse)Author
2023-07-06make tools::Poly*gon single-arg constructors explicitNoel Grandin
which will help avoid ambiguity in method calls in an upcoming patch Change-Id: Ic7607ac7d95559e0942a84fb3226cfdd6ade22bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154146 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-06loplugin:unusedfields all-can-be-privateNoel Grandin
these fields can be private Change-Id: I74423a9ae2ef0263a28c8a716ab1c55861e453d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-06ScanlineFormat::N1BitLsbPal is unusedNoel Grandin
ever since commit 4160be791daaef1a0c059a248f678cbad6408a69 Author: Caolán McNamara <caolanm@redhat.com> Date: Tue Jan 10 20:55:31 2023 +0000 no more X11SalBitmap Change-Id: I9dd55acdde6af1bf7501a71e92725ab739801b0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154060 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-05loplugin:unusedenumconstantsNoel Grandin
Change-Id: I53817a6b017203d8694032320869d11412c57ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154027 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-04CppunitTest_vcl_graphic_test: Demultiplex test codeXisco Fauli
and relax hack a bit, enabling webp based on testname is dirty since they might change Change-Id: Id933095701d01426d2802d6a194d6f74c07baaa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153957 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-06-29tdf#104877 Implement APNG blending modesParis Oplopoios
Change-Id: Ib7ce4d113ccaa4843b8332087ebe52ac3828180e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153556 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-06-27loplugin:stringstatic look for more stringsNoel Grandin
that can be initialised at compile-time instead of runtime Change-Id: I08d516fdc13a3a79f93c079f89ac44cbc7a1ed71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-24tdf#156016 Fix bug where SVG check size would be 0Paris Oplopoios
Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
2023-06-16ofz#59854 Null-dereference WRITECaolán McNamara
Change-Id: Iedbf21248b7d75474ea325905569d192360380f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153155 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-14Remove duplicate constants relating to PNGsParis Oplopoios
The PNG signature constant was defined in multiple places Change-Id: Ia90636819341295129a37a91199857a612d62177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153032 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
2023-06-14ofz#59817 Heap-buffer-overflow READ 8Caolán McNamara
Change-Id: I442d103c7103c0bd88dd7fdefd44c3274a9c80fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153038 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-14Fix typoAndrea Gelmini
Change-Id: I042c738e5d6e037a8c658a02cbfaef8f1d23799e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152999 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-14Fix heap-buffer-overflow in vcl/PngImageReaderJulien Nabet
From Jenkins_Linux_Ubsan: 25488 ==1050==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030001a44a4 at pc 0x0000004b6b04 bp 0x7ffed00d4630 sp 0x7ffed00d3de0 25489 WRITE of size 24 at 0x6030001a44a4 thread T0 25490 #0 0x4b6b03 in __asan_memcpy /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22 25491 #1 0x7f3dab812b94 in SvStream::ReadBytes(void*, unsigned long) /tools/source/stream/stream.cxx:1134:17 25492 #2 0x7f3da1fc7a8a in (anonymous namespace)::getImportantChunks(SvStream&, SvStream&, unsigned int, unsigned int) /vcl/source/filter/png/PngImageReader.cxx:270:27 25493 #3 0x7f3da1fb7364 in (anonymous namespace)::reader(SvStream&, Graphic&, GraphicFilterImportFlags, vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &(Bitmap::AcquireWriteAccess())>*, vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &(AlphaMask::AcquireAlphaWriteAccess())>*) /vcl/source/filter/png/PngImageReader.cxx:714:13 25494 #4 0x7f3da1fb9663 in vcl::PngImageReader::read(Graphic&) /vcl/source/filter/png/PngImageReader.cxx:830:55 25495 #5 0x7f3d8299c092 in PngFilterTest::testApng() /vcl/qa/cppunit/png/PngFilterTest.cxx:380:32 ... since bf944e33569e4a1d6236a54671b7320cdc6ffaf6 tdf#104877 Add basic APNG format support Change-Id: Ib46637a8422e1fbb1ab84ee69bf6f95299dd84a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153003 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-13cid#1532379 Untrusted loop boundCaolán McNamara
and cid#1532378 Untrusted loop bound Change-Id: I06f9267f02a6f41559d617c1a43671d4a8234350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152964 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-12ofz#59762 Out-of-memoryCaolán McNamara
this one is a writable SvMemoryStream so Seek(Rel) will attempt to resize if the destination is outside the current size Change-Id: I1f29531979ced103c51bd423ea0d5665f2b5bdb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152895 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-12ofz#59759 Null-dereference READCaolán McNamara
since: commit bf944e33569e4a1d6236a54671b7320cdc6ffaf6 Date: Mon Feb 6 14:19:41 2023 +0200 tdf#104877 Add basic APNG format support Change-Id: I45080e226f0ad4ccb99b6285c77ed19b702b74d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152893 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-11tdf#154168 Export no transparency PNGs correctlyParis Oplopoios
When bTranslucent was false the function would simply return, causing a 0 byte png. Now we just remove the alpha channel. Change-Id: Ie2578185ac12fb38b6f1b674758e564721e3973f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152840 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
2023-06-10Fix typoAndrea Gelmini
Change-Id: I797bf9d49d1a0f2cd4d9c523a46bb6ed979581e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152841 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-10tdf#104877 Add basic APNG format supportParis Oplopoios
Add basic APNG (animated PNG) format support that can correctly display simple files with no transparency Change-Id: Ibfb6e13953a8ba48a535a40b08792b3723b7dc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140089 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-06-09MCGR: tdf#155479 repair gradient SVG export for MCGRArmin Le Grand (allotropia)
Unfortunately SVG export is based on metafiles and thus there is (in principle) no way to get the BGradient/ColorStop/MCGR data transfered as needed. For that, using UNO API to read the model or using B2DPrimitives would help - as is better for the export respectively. Since there is not the time to re-design SVG export I added this 'compromize' as a fix. It gets the needed data transported over the metafile (that part is the compromize). It then exports the MCGR data to SVG (at least - as was already there - if it's a linear/axial gradient). This happens now with all Gradient Stops when there is a MCGR gradient. That part is/will hopefully be re-usable if SVG export gets redesigned. I also added a handling for StepCount feature, so when used (in LO, others do not have that) 'hard' color stops get generated to make the gradient look identical for SVG export. Had to make adding of that extra-information in metafiles dependent on exporting really to SVG. There are 51 cases which use 'MetaActionType::COMMENT' which would potentially have to be adapted. Also added code to solve the problem for TransparencePrimitive2D at VclMetafileProcessor2D::processTransparencePrimitive2D. This will now - also only for SVG export - directly create the needed MetaFloatTransparentAction and add additional MCGR information. This will be used on SVG export to write a 'Mask' as was done before. This is now capable of creating fill MCGR-Masks in the sense that any number of TransparencyStops will be supported. Change-Id: Ic6d022714eae96b8fbc09e60652851ac5799b757 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152623 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-06-08pdfium: better suport for annotations and some fixesJaume Pujantell
Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152606 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-05-28Use getXWeak in vclMike Kaganski
Change-Id: I665c9dc8c4f9cc4a996d9bf990cbfa33822bd07f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150885 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-26replace find_if by none_ofDr. David Alan Gilbert
A set of cases where find_if is used just to test if there are no matches; use none_of as per tdf#153109 Change-Id: I6c705ab7a8289914743199722a444ee40d11d746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152200 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-20loplugin:unusedmethodsNoel Grandin
Change-Id: Ief95f111350808f010539bb733a553007d30a9df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152006 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-12ofz#58883 Out-of-memoryCaolán McNamara
Change-Id: I91de8f537ae237de814ed7e933fb6d0a3cc98466 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151708 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-08unique_ptr->optional for BitmapNoel Grandin
since Bitmap is really just a tiny wrapper around SalBmp Change-Id: Ie2c9be40f6abba72c600c6778ec42d0689c66558 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151498 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-07use AlphaMask for variables when calling GetAlphaMaskNoel Grandin
Right now this doesn't make any difference, since Bitmap is the superclass of AlphaMask. But when I switch to using alpha instead of transparency, passing AlphaMask around is going to mean something different to passing plain Bitmap around. Change-Id: Ic1541e5f0a3b97331793cd23e23115faa7f382b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151463 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-06cid#1529287 Explicit null dereferencedCaolán McNamara
after commit c55d5586304f23f9d8acbaffefba68a3a11c6175 Date: Sat Apr 1 16:10:33 2023 +0100 BinaryDataContainer: hand out shared_ptr's to SvStreams. and commit 0f2581204a70038ed7ca78089a9bd96d158e02c0 Date: Mon Apr 3 09:34:54 2023 +0100 BinaryDataContainer swap out implementation. it is possible that a eLinkType of GfxLinkType::NativeGif and a nStreamLength of 0 could lead to BinaryDataContainer::getAsStream being called on a default ctored BinaryDataContainer which would mean an mpImpl of null and a null dereference here Change-Id: Id964e3ce97e5527c5357576131fe03440f1ea00c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151453 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-04-21MCGR: Reduce diverse GradientStyle enums to single UNO API oneArmin Le Grand (allotropia)
Change-Id: Ie0cd26a308a75ddead9451c53e874a39cc6eeb63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150705 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-13BinaryDataContainer: hand out shared_ptr's to SvStreams.Michael Meeks
Hide the SvMemoryStream implementation detail better - this could be served from a file in future. Also couple lifecycle of the SvMemoryStream to the vector backing it. Change-Id: Ia9b28b57b8df4ce57286effd4d1753bf345fc10e Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149917 Tested-by: Jenkins
2023-04-11Drop Writer::OutLongMike Kaganski
... and use SvStream::WriteNumberAsString, replacing Write[U]Int32AsString Change-Id: I10e56c532494239ed40ec01b6184dd06db463a0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150193 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-10Drop SvStream::WriteCharPtrMike Kaganski
WriteOString is a better replacement Change-Id: Ic431b9aeb98d19fe61cff71360eee555105cc2bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150192 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-10tdf#154631: fix Export as gif ignores transparence of objectsJulien Nabet
As noel indicated in https://bugs.documentfoundation.org/show_bug.cgi?id=154631#c6 "GIF does not (as far as I can tell) support partial transparency, it only has full or none transparency. See specs linked from https://en.wikipedia.org/wiki/GIF" Change-Id: Ib110f344a6b8f0fdfd1355e6521d979b33548709 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150184 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-03BinaryDataContainer: pure re-factor to encapsulate stream copying.Michael Meeks
Change-Id: Iab24e8d18bf7badbca672fbdbf455f78d08f41a0 Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149905 Tested-by: Jenkins
2023-04-02use the same max size that libtiff defaults to for its own utilitiesCaolán McNamara
Change-Id: I67a769a6108fb8590d6304390a4f27ef95927c9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149922 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-30loplugin:stringadd in vclNoel Grandin
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: I44ce7183e4b292269fac1e3d2217286bf5abe823 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149752 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-25ofz#57134 TimeoutCaolán McNamara
Change-Id: I81cded1dc765d4939a03d46f7df293dfebddcfbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149585 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-15ofz#55729 Out-of-memoryCaolán McNamara
Change-Id: I16713a23093483041e9ac03a7fe6cc3e2960ac31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148915 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-14use more string_view in vcl::PDFObjectContainerNoel Grandin
which makes the call sites much less verbose Change-Id: I94eef7569e419f134ce574ecd9fb2ce8f50184b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-08Simplify usage of BinaryDataContainerMike Kaganski
It is always used to store data read from streams Change-Id: I613bc446eaadf98d2b1c012002d38f23d79a40ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148450 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-07Fix a bug parsing pdf arraysJaume Pujantell
The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-03-07Drop VectorGraphicDataArrayMike Kaganski
Change-Id: If444317edf35d0627c6bc3a8c36ba973a8a0af8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148371 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2023-03-06clang-tidy dead-storeNoel Grandin
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-05tdf#153180: PngImageWriter add support for gray alpha colortypeSarper Akdemir
8 bit grayscale images can have alpha accompanying it, and PNG supports 2 channel gray-alpha images. libpng supports this with the use of colortype PNG_COLOR_TYPE_GRAY_ALPHA. This patch adds support for writing GRAY_ALPHA colorType PNG images. This is done by expanding what was in place for ScanlineFormat::N24BitTcRgb with alpha PNG_COLOR_TYPE_RGBA. Change-Id: I80d462d784f91529eb9371c6bdb029c78f32f81e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146138 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-02-28move sanitizing of Size inside GenericTypeSerializerNoel Grandin
I cannot see a useful application of a Size that is negative (at least not in a file format). Change-Id: I0c5bd8c7d3987a5c7803af2a6ae0543c4a6d7754 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147884 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-27ofz#56293 TimeoutCaolán McNamara
Change-Id: I8c6385b879d517b3f40a33d139295aeafb1c6354 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147874 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-17crashreporting: divide by zero, aPrefSize.Width() must have been 0 hereCaolán McNamara
Change-Id: I5ee2c1f4386c95c12fb821a3514cb732b220bb86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147174 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-16Resolves: tdf#151395 need to track tiff offset from start of streamCaolán McNamara
when importing them from EPS Change-Id: Ia3ba2aa188f8dcee0ede6d43311c5dcdccb1eb25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147162 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-07improve readability of VirtualDevice constructorNoel Grandin
(a) It is not obvious what DeviceFormat::DEFAULT means (b) There are two parameters (each with two states), but only really 2 possible overall states So (1) use more useful names (2) combine the two parameters into one enum Change-Id: Ic0595b39e032cc9e019b88326389d055b977da00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-20ofz#54685 TimeoutCaolán McNamara
Change-Id: I2f71f61c371055521c884a00dde48a811d204df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145875 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>