summaryrefslogtreecommitdiff
path: root/include/vcl/graphicfilter.hxx
AgeCommit message (Collapse)Author
2019-10-31Fix IsTransparent() for unloaded graphicsLuke Deller
Fix Graphic::IsAlpha() and Graphic::IsTransparent() for unloaded graphics. This fixes tdf#118036. GraphicDescriptor::Detect(true) is currently used to read the image size from the header of images which are not being fully loaded yet. This change extends GraphicDescriptor to also report whether the image supports transparency or alpha, implemented only for PNG format so far. Change-Id: I1753c0d11491f1dc518e23da8d7b3842945770cb Reviewed-on: https://gerrit.libreoffice.org/81785 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-23loplugin:returnconstval in vclNoel Grandin
Change-Id: Id4a0b460ba3c43e80b80ae6e2da9e40a6753e14c Reviewed-on: https://gerrit.libreoffice.org/77965 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-22loplugin:constmethod in vclNoel Grandin
Change-Id: I20545527b117c9562b91076b748fb3e2659d2497 Reviewed-on: https://gerrit.libreoffice.org/77944 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15loplugin:sequenceloop in unoxml..vclNoel Grandin
Change-Id: Ic3c48ec4d86252b62d3dd25bbc198f7d7fb75e90 Reviewed-on: https://gerrit.libreoffice.org/77533 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-04vcl lok: pre-load graphic librariesMiklos Vajna
This is needed to be able to load e.g. TIFF files in Online, which does not have code in the chroot since online.git commit ad21717498cc214d5d5d5c0ff378238552137e2f (Avoid copying most code into the chroot jail., 2018-03-10). Change-Id: Ib095191ee690d9da6269878a82b1c6995df50dfa Reviewed-on: https://gerrit.libreoffice.org/75077 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-06-11tdf#125591 DOC import: lazy-load metafiles with explicit sizeMiklos Vajna
Regression from commit 69b62cfcbd364d7f62142149c2f690104b217ca1 (tdf#125281 DOC import: fix size of lazy-loaded metafiles, 2019-05-27), the problem is that setting the preferred size of a Graphic swaps it in. Avoid this by extending ImportUnloadedGraphic(): if a size hint is provided, then that will be used instead of info from the graphic descriptor (which is usually only meaningful for bitmaps). This way we maintain the correct size and we're back to lazy-loading metafiles from binary MSO files as well. Change-Id: Ide12d12166110e98ea47b5347dd24fb203b22da3 Reviewed-on: https://gerrit.libreoffice.org/73798 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-04-24lazy image loading shouldn't read the entire .xls file (tdf#124828)Luboš Luňák
b11188835d3b87cd changed msfilter to use GraphicFilter::ImportUnloadedGraphic() to lazy-load images from the document. However, that function in some cases simply reads the entire rest of the passed SvStream, which in this case is the entire .xls file. And the document from tdf#124828 is ~50MiB and contains ~4000 images => 100+ GiB memory required. Change-Id: I74926383204ec642eabb28b62e2cf2e1ff8054a9 Reviewed-on: https://gerrit.libreoffice.org/71136 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-11find-unneeded-includes: Avoid proposing o3tl fw declarationGabor Kelemen
This does not really work: even when it seems to, it compiles only because of transitive includes - Filter o3tl/typed_flags_set.hxx in f-u-u - Remove already added fw declarations from hxx files and include full header just in case - Remove now unnecessary blacklist entries Change-Id: Ie0de6667af697095a623b435806449e7e28a6004 Reviewed-on: https://gerrit.libreoffice.org/64659 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-04remove unnecessary GraphicFilterImportFlags::AllowPartialStreamReadNoel Grandin
Change-Id: I43036745b50e99dc47bb9b63f78e8f3c6eea2c89 Reviewed-on: https://gerrit.libreoffice.org/64486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-27tdf#42949 Fix IWYU warnings in include/vcl/[f-h]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ice2eb8c5994bf2ccb88972332ca4a1d3ed41752a Reviewed-on: https://gerrit.libreoffice.org/63826 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-10-20ImpDetectPCX 2nd arg always overwrittenCaolán McNamara
Change-Id: I0ec1e71d40c34f021003330c4dd0a8d5ee2b6ce2 Reviewed-on: https://gerrit.libreoffice.org/62018 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-09-14loplugin:constfields in vclNoel Grandin
Change-Id: I1072642be4fdfa720e61f2d7bad3c2701eb81610 Reviewed-on: https://gerrit.libreoffice.org/60430 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-10pass SvStream around by std::unique_ptrNoel Grandin
and give utl::OStreamWrapper a new constructor so that it knows it is taking ownership of the SvStream, which appears to fix several leaks Change-Id: Idcbcca9b81a4f0345fd8b8c8a2f4e84213686a6b Reviewed-on: https://gerrit.libreoffice.org/57187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-05tdf#102928 PDF export: do recompress CMYK imagesMiklos Vajna
The export filter writes /DeviceRGB unconditionally, so for now don't optimize CMYK image handling here. Though the added GraphicDescriptor API allows supporting this natively in the export filter in the future. Change-Id: I76b44b910948467aeb1f15e5ae765201d183c99d Reviewed-on: https://gerrit.libreoffice.org/55343 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.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-17loplugin:useuniqueptr in GraphicFilterNoel Grandin
Change-Id: Ib359da131c84c291504a9df210a3b222fd77bd0c
2018-01-12More loplugin:cstylecast: vclStephan Bergmann
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I363c01a1ae9e863fca4fb4589829492d7280d711
2017-11-03vcl: remove sgf/sgv ancient gfx filtersThorsten Behrens
Change-Id: Ib02986e5b3d54d65982836e22ebcb70eb7a0e7b3 Reviewed-on: https://gerrit.libreoffice.org/44216 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2017-10-05loplugin:finalclasses in vclNoel Grandin
Change-Id: I7de9cd6c5569217aa8d379c6d112cd1874bca8e2 Reviewed-on: https://gerrit.libreoffice.org/43151 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-27convert code-class in ErrCode to scoped enumNoel Grandin
Change-Id: I9aa8703921308d6fee8bae9ee2d7b29e19181cc7 Reviewed-on: https://gerrit.libreoffice.org/41601 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-24remove unused error code in vclNoel Grandin
ever since commit 920d4463f6e59b815852c173e2974ffc7b4bb284 Date: Thu Jun 23 13:13:28 2016 +0200 loplugin:singlevalfields in vcl(part1) Change-Id: I3691d03dadff10585a119ca8db8aa193b5a01702 Reviewed-on: https://gerrit.libreoffice.org/41492 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-22Convert ErrCode area to scoped enumNoel Grandin
Change-Id: Ifa365bbac3c7eb21da9381ec8bb3be6b6785016b Reviewed-on: https://gerrit.libreoffice.org/41402 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18loplugin:constparams in vclNoel Grandin
Change-Id: I36afe2107e07ffb9b73c0b76be600e3e999a0fd4 Reviewed-on: https://gerrit.libreoffice.org/40116 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-15emfplus: completed isolation/migration of Emf/WmfArmin Le Grand
Decided to keep the migrated/isolated Emf/Wmf reader which are now hidden behind a Uno Api. Had to re-implement WMF_EXTERNALHEADER (now WmfExternal, own file/header) to not break anything. It *seems* to just scale something and could be done after import, but I could not be sure. Also needed a callback hook to allow getting the Metafile out of a MetafilePrimitive in a lower module (vcl relative to drawinglayer) which is needed as long as primitives are not completely on Uno Api. Deleted all Emf/Wmf reader stuff from vcl. Change-Id: Ic5540defa8ec770728280df4df3f12e1f48cfc3a
2017-06-21convert ErrCode to strong typedefNoel Grandin
would have preferred to re-use o3tl::strong_int, of which this is a modified copy, but there are lots of convenience accessors which are nice to define on the class. Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a Reviewed-on: https://gerrit.libreoffice.org/38497 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-17loplugin:unusedfields in vcl part1Noel Grandin
Change-Id: I67d176003f39992cd0ff9271a7d6ce26d2cb6619 Reviewed-on: https://gerrit.libreoffice.org/38828 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-05Improved loplugin:cstylecast to reference types: vclStephan Bergmann
Change-Id: I86d31a6dcd01700d6ac8712134f82f0cc83e46f6
2017-06-02convert GRFILTER constants to ERRCODE_GRFILTER_Noel Grandin
since various code mixes these constants in with ErrCode values from other code, let us just make it into real ErrCode values. Change-Id: Ifa3d0f7526172609a44e6749bed9f730ab6b1a95 Reviewed-on: https://gerrit.libreoffice.org/38313 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-23vcl GraphicFilter: add ImportGraphics()Miklos Vajna
This is similar to ImportGraphic(), but can handle multiple streams with one function call. Change-Id: I8d5dc8de64321c3c1fb9e1037527b411fd68dca8 Reviewed-on: https://gerrit.libreoffice.org/37953 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-05-08vcl: split jpeg import into two partsMiklos Vajna
Split the import into two: 1) Just create the bitmap, this part is not thread-safe (e.g. OpenGLContext::makeCurrent() is called when OpenGL is enabled). 2) Import the image into an existing bitmap. The point is that the second part takes much more time than the first, and in the future that part may be executed on a thread, while without such a split the whole ImportJPEG() can't do that. For now GraphicFilter::ImportGraphic() simply invokes the two parts after each other, so no real functional changes yet. Change-Id: Iee742a2cd3c581aeaf1a1ed9f55cd543955a85e0 Reviewed-on: https://gerrit.libreoffice.org/37397 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-11-23loplugin field-can-be-private in include/vcl..xmlscriptNoel Grandin
Change-Id: Ia03f7cccb256d825daa4dc6f4c0598448e46e6cf Reviewed-on: https://gerrit.libreoffice.org/31069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-15loplugin:countusersofdefaultparams in include/vclNoel Grandin
Change-Id: I16979e6d49e7f1ff7ea53194cfc64fddf27d00cf Reviewed-on: https://gerrit.libreoffice.org/30841 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-04loplugin:unnnecessaryvirtual in vclNoel Grandin
Change-Id: Ifa8bfafb2e527ce5976f3bd310d107cb2840a5f6 Reviewed-on: https://gerrit.libreoffice.org/30531 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-05Remove _TYPED suffix from tools/link.hxx macrosStephan Bergmann
...which was introduced with 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed "Gradually typed Link" to distinguish the new, typed versions from the old, untyped ones, but is no longer necessary since 382eb1a23c390154619c385414bdbe6f6e461173 "remove untyped Link<>" removed the old versions. Change-Id: I494025df486a16a45861fcd8192dfe0275b1103c
2016-09-18loplugin:unusedenumvaluesNoel Grandin
Change-Id: Icf17f936ce6d07d0e152252833c8645cf9b1163b Reviewed-on: https://gerrit.libreoffice.org/28942 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-15loplugin:countusersofdefaultparams in vclNoel Grandin
Change-Id: I046e6f16c5b171a06e2be2da2f72340634f3e979 Reviewed-on: https://gerrit.libreoffice.org/28891 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-07loplugin:constantparam in vclNoel Grandin
Change-Id: I0cae8e5de1170dec4c82df7f1f5377143a079876 Reviewed-on: https://gerrit.libreoffice.org/28686 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-31loplugin:countusersofdefaultparamsNoel Grandin
Change-Id: I697b9081424acdc61107709392baa8af8ce29028 Reviewed-on: https://gerrit.libreoffice.org/28497 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-24vcl: add graphic export-as-pdf filterMiklos Vajna
In case the metafile was imported from a PDF originally, then this allows storing the PDF stream next to the graphic. This means that e.g. in Writer choosing 'Save' from the context menu of the graphic can write the original PDF stream, not the replacement metafile. Change-Id: I4ab45d5af17fe46d7538df6d79d6b57ed163572a Reviewed-on: https://gerrit.libreoffice.org/26628 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-06-24loplugin:singlevalfields in vcl(part1)Noel Grandin
Change-Id: I0031199937cc95793951a070c4b3d8910933e69f Reviewed-on: https://gerrit.libreoffice.org/26595 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-23vcl: add initial PDF import-as-graphic filterMiklos Vajna
This allows Insert -> Image e.g. in Writer to read a PDF file, and insert the metafile equivalent of the first page into the document. Currently the original PDF document is lost on import (unlike when inserting an SVG file). Change-Id: Ib0472c5d9bd9a1da054353fa3a3a638a1052721e Reviewed-on: https://gerrit.libreoffice.org/26586 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-02-26loplugin:unuseddefaultparams in /include/vclNoel Grandin
Change-Id: I36daccd90bfa6ba0ee8b9e76bff2bd8494155a04 Reviewed-on: https://gerrit.libreoffice.org/22710 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17use consistent #define checks for the Windows platformNoel Grandin
stage 2 of replacing usage of various checks for the windows platform with the compiler-defined '_WIN32' macro In this stage we focus on replacing usage of the WIN macro Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84 Reviewed-on: https://gerrit.libreoffice.org/22393 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
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>
2016-02-09Formatting changes across all modulesChris Sherlock
+ Removed comment cruft + Tab formatting in number of files + Some commented out code removed + Tab characters replaced with spaces + Newline cleanup in quite a few files + Tweak header guard #endifs Change-Id: I3208ff2f047da890edcc49b73389aca22442f5fc Reviewed-on: https://gerrit.libreoffice.org/22221 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@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
2015-10-27loplugin:unusedmethodsNoel Grandin
Change-Id: I161cd52606c11b6008f5d8b1d8ee391692f91861 Reviewed-on: https://gerrit.libreoffice.org/19231 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-23com::sun::star->css in include/ucbhelper to include/xmlscriptNoel Grandin
Change-Id: Iaa7f0b8455a601d3992c08cde0943c709c417256
2015-10-12Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I328ac7a95ccc87732efae48b567a0556865928f3