summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/gfxlink.cxx
AgeCommit message (Collapse)Author
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>
2022-07-13clang-tidy modernize-pass-by-value in vclNoel Grandin
Change-Id: I9ddb786eb88213c53cf53067ced6899ca40ac6e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137000 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-31support for the WebP image format (tdf#114532)Luboš Luňák
This commit implements a WebP reader and writer for both lossless and lossy WebP, export dialog options for selecting lossless/lossy and quality for lossy, and various internal support for the format. Since writing WebP to e.g. ODT documents would make those images unreadable by previous versions with no WebP support, support for that is explicitly disabled in GraphicFilter, to be enabled somewhen later. Change-Id: I9b10f6da6faa78a0bb74415a92e9f163c14685f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128920 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-30loplugin:constmethod handle more casesNoel Grandin
remove some of the naming limitations, and handle pointer parameters better. I only let the plugin run up till vcl/ Change-Id: Ice916e0157031ab531c47f10778f406b07966251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-11change usage of boost::hash_combine to o3tl::hash_combineTomaž Vajngerl
Change-Id: I840518a36ac43d36c95f38e09c7bfcfe1a25a525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114984 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-12-28vcl: add BinaryDataContainer and change GfxLink to use itTomaž Vajngerl
Add a wrapper for shared_ptr<sal_uInt8> called BinaryDataContainer, which is used to easily manage the binary data - mainly for a better reuse, control and to prevent duplication. Change-Id: I68140ec379dba4a5ab1b624a334129bba2401998 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108255 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-04-17cid#1462264 Uninitialized scalar fieldCaolán McNamara
Change-Id: I4b733bf37132073ece55fa392c06086410f6f914 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92393 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-09tdf#104878 speed up GfxLink compareNoel Grandin
which shaves 5% off the rendering time Change-Id: Iab2a92088c5d1e8840a53ff57ab1a95ba5ec8e0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91947 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-05vcl: move read and write to/from GfxLink to TypeSerializerTomaž Vajngerl
Change-Id: Ie99d00ea54296f5f3a909ade7115d9a9251f688e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89983 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-03-05vcl: put first and last native type into GfxLinkType enumTomaž Vajngerl
Until now we had define GFX_LINK_FIRST_NATIVE_ID and define GFX_LINK_LAST_NATIVE_ID which pointed to the first and last type n the GfxLinkType which represented the native type. A more elegant way to solve this is to assign an alias to the first and last value. So now we have "NativeFirst" and "NativeLast" defined in the GfxLinkType enum instead. Change-Id: I5613a1b544fc7ae4f8b884df94c6fa4e2fb322d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89982 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-09-29Move Rectangle,Point,Size serialization to GenericTypeSerializerTomaž Vajngerl
Change-Id: Iae489fc31b13b836e1df5327ba2fa07e0325907a Reviewed-on: https://gerrit.libreoffice.org/79793 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-08-28tdf#42949 Fix IWYU warnings in vcl/source/[o-w]*/Gabor Kelemen
Plus a quick recheck for files in vcl/source/[a-g]*/ Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ia1ae951047be2e034da5f3b0422613ddb0a091ad Reviewed-on: https://gerrit.libreoffice.org/78065 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-24tdf#42949 Fix IWYU warnings in vcl/source/[f-i]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I9991a1f4d8dde51b38cf8d114e4fb69ff4a349ea Reviewed-on: https://gerrit.libreoffice.org/75248 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-23loplugin:unusedmethodsNoel Grandin
Change-Id: I3bde62d674f5beaa6d19dcd22e6be15dfefe4205 Reviewed-on: https://gerrit.libreoffice.org/76118 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-17loplugin:unusedmethodsNoel Grandin
Change-Id: Ie2285f64919d1c83b0a8df4ceb827f731e5cd609 Reviewed-on: https://gerrit.libreoffice.org/75739 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-17At least log errors in GfxLink::GetSwapInDataStephan Bergmann
I happened to get the below -fsanitize=invalid-null-argument failure just once during `--convert-to pdf xlsx/tdf114171-1.xlsx`, presumably as a consequence of an unknown error here. > tools/source/stream/stream.cxx:1687:24: runtime error: null pointer passed as argument 2, which is declared to never be null > /usr/include/string.h:43:28: note: nonnull attribute specified here > #0 in SvMemoryStream::GetData(void*, unsigned long) at tools/source/stream/stream.cxx:1687:9 > #1 in SvStream::ReadBytes(void*, unsigned long) at tools/source/stream/stream.cxx:1232:18 > #2 in SvStream::readNumberWithoutSwap_(void*, int) at tools/source/stream/stream.cxx:149:9 > #3 in void SvStream::readNumberWithoutSwap<unsigned int>(unsigned int&) at include/tools/stream.hxx:412:7 > #4 in SvStream::ReadUInt32(unsigned int&) at tools/source/stream/stream.cxx:828:5 > #5 in GraphicDescriptor::ImpDetectGIF(SvStream&, bool) at vcl/source/filter/graphicfilter2.cxx:185:10 > #6 in GraphicDescriptor::Detect(bool) at vcl/source/filter/graphicfilter2.cxx:66:19 > #7 in ImpGraphic::ImplSetPrepared(bool, Size*) at vcl/source/gdi/impgraph.cxx:541:25 > #8 in GraphicFilter::ImportUnloadedGraphic(SvStream&, unsigned long, Size*) at vcl/source/filter/graphicfilter.cxx:1407:43 > #9 in (anonymous namespace)::GraphicProvider::queryGraphic(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at vcl/source/graphic/UnoGraphicProvider.cxx:410:44 > #10 in non-virtual thunk to (anonymous namespace)::GraphicProvider::queryGraphic(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at vcl/source/graphic/UnoGraphicProvider.cxx > #11 in oox::GraphicHelper::importGraphic(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, WmfExternal const*) const at oox/source/helper/graphichelper.cxx:275:39 > #12 in oox::GraphicHelper::importEmbeddedGraphic(rtl::OUString const&, WmfExternal const*) const at oox/source/helper/graphichelper.cxx:363:24 > #13 in #33 in oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) at sc/source/filter/oox/drawingfragment.cxx:112:30 [...] Change-Id: I7fb38aad6b2147d650e3907d5734d8ade84353d8 Reviewed-on: https://gerrit.libreoffice.org/74165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-17clang-tidy readability-redundant-smartptr-getNoel Grandin
redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-06inline GfxLink::SwapInNoel Grandin
only called from one site Change-Id: I2f8cb927df2f4f389c5d1bee19845aed5535663b Reviewed-on: https://gerrit.libreoffice.org/61437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-31Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directory vcl Change-Id: I205fe0f4e80a66cd9c3b19f7e9716411da1d1cf5 Reviewed-on: https://gerrit.libreoffice.org/58221 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-19tdf#103913 keep ".emf" file extension and mime typeLászló Németh
in documents, don't change them to wmf and image/x-wmf silently, resulting for example, dropping or rejecting modified documents by firewall packet filtering. Change-Id: I3b8634ae022c7c026b0ed4ebc345c1c3b3f96337 Reviewed-on: https://gerrit.libreoffice.org/56045 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
2018-04-20Function to load graphic swapped out (loaded on demand)Tomaž Vajngerl
When a document is loaded it takes a lot of time and memory to load the graphic that are in the documet, so avoid that and just store the compressed graphic into a temporary file (handeled by GfxLink) and load when we really need to show the graphic. GraphicObject cached some attributes from Graphic, but this attributes now aren't available immediately so this attributes are removed form GraphicObject and now delegate to the Graphic itself. GetSizeBytes attribute however was removed as it is only used in some tests. GfxLink initial values were moved to the constructor and are not set in the header file anymore (as it is the recommended way to do it). The SdImportTest::testDocumentLayout failed as it looks like the dump sometimes didn't include the width and height of the null bitmap (which is set to 32x32) of the FillBitmap in some situations, but then in other situations it did include this attributes. With this change the width and height are always included for the FillBitmap which looks like it is more correct. Change-Id: Ia1218f93b1735402b7828404f65660e2d4acf32f Reviewed-on: https://gerrit.libreoffice.org/53016 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-01-15More loplugin:cstylecast: vclStephan Bergmann
Change-Id: I74d1555b461fd8ea316380423fcde2d167714170
2017-09-29convert GfxLink::IsEqual to operator==Noel Grandin
exactly one use site Change-Id: Id0a75d46c459be213e81b47aa6c1194c87aec848 Reviewed-on: https://gerrit.libreoffice.org/42891 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-18loplugin:unnecessaryparenNoel Grandin
look for statements like return (function()); Change-Id: I906cf2183489f87225b99b987caca67e39b26cc3 Reviewed-on: https://gerrit.libreoffice.org/41260 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-08cleanup tools/debug.hxx includesJochen Nitschke
with command > git grep -l tools/debug.hxx | xargs grep -L DBG_ | xargs sed -i '/#include *\(<\|\"\)tools\/debug.hxx.*/d' don't change files in includes/ and */pch Change-Id: Ie429d6a7dca5dfa1073e0f5ba037f7c84bdbec08 Reviewed-on: https://gerrit.libreoffice.org/37349 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-02we're either reading or writing, not bothCaolán McNamara
Change-Id: I6b004c7f7957f3843d37063b182cac0cd07e5f44
2017-04-02SwapOutData url is always a file urlCaolán McNamara
so can just use SvFileStream here and not go through ucb Change-Id: I1d70a4e39977a178afaf7eeadb552f1bd7d9fd1a Reviewed-on: https://gerrit.libreoffice.org/36024 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-03-16reinstate utl::TempFile changeCaolán McNamara
This reverts commit 5411d99c0a7345e9c68ad55debcb20eecdc0b36a.
2017-03-15rollback utl::TempFile changeCaolán McNamara
2017-03-15utl::TempFile can give a stream directly without bringing ucb into itCaolán McNamara
Change-Id: Ic6eb0934fdb63492d831b9dad07e93c968ee9bf2
2017-03-10ofz#786 avoid svm oomCaolán McNamara
Change-Id: Ib4920d6537437fe060c453f249fa7f8da230bfc7
2016-09-15replace sal_Size with std::size_t (or sal_uInt64 for SvStream pos)Michael Stahl
... except in include/rtl, include/sal, include/uno, where sal_Size is retained for compatibility, and where callers of rtl functions pass in pointers that are incompatible on MSVC. Change-Id: I8344453780689f5120ba0870e44965b6d292450c
2016-08-30default dtors are fine hereCaolán McNamara
Change-Id: I503f954a2729aa2737d783ed8c72f62d8a68da4c
2016-08-27put StreamMode masks in scope of enum classJochen Nitschke
Change-Id: I77682f7e289a59b986bb84edf014029a20266470 Reviewed-on: https://gerrit.libreoffice.org/28420 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-17convert DBG_ASSERT in vclNoel Grandin
Change-Id: I732fb1a789f90ca7a7f393cc41a6afe84fecf3d3 Reviewed-on: https://gerrit.libreoffice.org/26200 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-08Simplify GfxLink using smart pointersMark Page
Uses std::shared_ptr for sharing graphic data Changed constructor to std::unique_ptr<sal_uInt8[]> to ensure the delete[] operator is called when GfxLink internals takes ownership of the data Change-Id: I4edd4634df8d6ba4d94953260c1a7ac560ccf04a Reviewed-on: https://gerrit.libreoffice.org/25402 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-06tools: rename SvStream::Read/Write to ReadBytes/WriteBytesMichael Stahl
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a Reviewed-on: https://gerrit.libreoffice.org/25972 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-05-31Convert GfxLinkType to scoped enumNoel Grandin
Change-Id: Iae074ef0927a55f1fbf401cb66f4f183213f547c Reviewed-on: https://gerrit.libreoffice.org/25656 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-24Revert "Simplify GfxLink using std::shared_ptr to clarify ownership"Stephan Bergmann
This reverts commit d64431ac5a7bede7661c64e0bd6d46805841e704, which caused ASan to complain about "alloc-dealloc-mismatch (operator new [] vs operator delete)" (while e.g. building Gallery_arrows), as GfxLink::mpSwpInData is a std::shared_ptr<sal_uInt8> holding a pointer to an array of sal_uInt8.
2016-05-23Simplify GfxLink using std::shared_ptr to clarify ownershipMark Page
The functionality has not changed in this class, however the ABI has changed (this class is DLL Public) Change-Id: I11005f03e747d56cb59550e071755429390db7a7 Reviewed-on: https://gerrit.libreoffice.org/25081 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-23tdf#98600 and tdf#98622 fix metafile parsing (part2)Noel Grandin
more regressions from commit db17d3c1 "new loplugin: memoryvar" Change-Id: I611697f2bc818f2f42a704bfb5297637c30060c9
2016-03-17loplugin:constantparam in toolsNoel Grandin
Change-Id: I3774661799c074561c694515baba42a375d0a077 Reviewed-on: https://gerrit.libreoffice.org/23301 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-16loplugin:constantparams in vcl/Noel Grandin
also some improvements to the plugin Change-Id: I0e3a519d70756e577fcb1bd47dd66864b5b4c871 Reviewed-on: https://gerrit.libreoffice.org/23289 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-15remove unnecessary parentheses in case labelsNoel Grandin
Change-Id: I987bf68c767709080c67c8b183c036a4109c6caa
2016-02-22loplugin:commaoperator in vcl/Noel Grandin
Change-Id: Ia5bbce27d9e9526122ce1e27389c7845e6709f27
2016-02-09Remove excess newlinesChris Sherlock
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2015-11-11new loplugin: memoryvarNoel Grandin
detect when we can convert a new/delete sequence on a local variable to use std::unique_ptr Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc Reviewed-on: https://gerrit.libreoffice.org/19884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I05e89f9896170d4df3d1377549ea074f06b884a0
2015-10-27Reduce scope of #include <tools/stream.hxx>Matteo Casalin
Change-Id: I0752cbb0cb2e0f89607d81d9eda7ce7091449fd6