summaryrefslogtreecommitdiff
path: root/include/vcl/graph.hxx
AgeCommit message (Collapse)Author
2021-01-26loplugin:passstuffbyrefNoel
Change-Id: I330e0ab6c9955939dad313f9d472f93e39dbd313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109924 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-22vcl: support creating a Graphic with only GfxLink as swapped-outTomaž Vajngerl
This adds support to create a Graphic with only a GfxLink and the Graphic is in a swapped-out state. This is similar to the prepared state, but the prepared state is a special state of the Graphic. In the future, all loading will probably be done in this way and prepared state will go away, but for now this is only supported for PDF and is used in PDFium import only. The main reason is to avoid that a multi-page PDF is immediately swapped out after loading, which just does unneeded work and freezes the application for a while. Change-Id: I409741d27a4ad309264cdf27b2ba03f2cf37ead9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109600 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-12-30vcl: remove {Read,Write}ImpGraphic and ImplExportNative from GraphicTomaž Vajngerl
ReadImpGraphic and WriteImpGraphic have been reimplemented in the TypeSerializer some time ago, but the code has not yet been moved to use that class. This commits does that and changes all the code using those 2 methods and removes them. With this implemented in the TypeSerializer, it is easier to handle In addition it also removes ImplExportNative (and the method on the Graphic interface). This was really used only in one method, and it could be implemented in the mthod itself. Change-Id: I0982429d1c1d5ed7ef07627d87ed9a08df43f040 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108256 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-10-19use tools::Long in vclNoel
Change-Id: Ice1055021e8568634e9a66ba89d3bb4ef4e731df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104522 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-06loplugin:const* make some params and methods constNoel
Change-Id: If7fbb25037343e18081a8ee7064840d75e9a45a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104010 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-15remove constructor with plain Bitmap from Graphic, use BitmapExTomaž Vajngerl
Change-Id: Ie429a10a8f54c6779d437ee4bc75a5ea0c427848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100727 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-05-03use more compact namespace syntax in /includeNoel Grandin
excluding the UDK headers of course Change-Id: Iac7ab83d60265f7d362c860776f1de9d5e444ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93268 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-27Graphic: cleanup private, public declarations, remove friendTomaž Vajngerl
Friend GraphicObject doesn't seem to be needed anymore. Change-Id: I629ddaabf0c1802e986af42b457cd6322d2fd04d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92949 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-04-12replace and remove VectorGraphicDataPtr typedef for the real typeTomaž Vajngerl
There is no need to hide std::shared_ptr<VectorGraphicData> type under an alias name. It doesn't make the code more understandble and it usually is the exact opposite because we know with what type we are dealing with. Change-Id: Iec80ee99697ff2fe3a8275fc2787b5370510ebe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92069 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-03-18pdfium: support for pages when using PDF import with pdfiumTomaž Vajngerl
Moving PDF to use VectorGraphicData in Graphic has temporary removed the support for showing different PDF pages when opening the PDF using pdfium (LO_IMPORT_USE_PDFIUM=1). This adds the support for back by specifying whcih PDF page to render when creating the VectorGraphicData (and can't be changd afterwards), which is used to create a Graphic and contains the PDF source data array. Change-Id: Ib915216b8d4c0c063d0fead44ff156b1915a35d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90562 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-03-17pdfium: Make Insert -> Image... use VectorGraphicData for PDF.Jan Holesovsky
In principle, the current Svg/Emf/Wmf and PDF handling is trying to achieve the same thing: Keep the original stream untouched, provide a replacement graphics, and a kind of rendering. To hold the data, the Svg/Emf/Wmf and PDF were using different structures though. This commit consolidatates that, and makes the Insert -> Image... (for PDF) actually using the VectorGraphicData to hold the original stream. This breaks loading the PDF as a document via PDFium - I'll fix it in the next commit(s). Change-Id: Iac102f32b757390a03438c165e430283851cc10b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90561 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-03-16Revert "loplugin:constfields in vcl"Noel Grandin
This reverts commit 59887868da3499c68d5f259cfa48178354397448. Change-Id: I0f3f6a7680c78103a559a0f881badc8211b97ace Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90544 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-13vcl: warn about unused GraphicConversionParameters instancesMiklos Vajna
I just made the mistake of creating one but then forgetting to use it, warn about that. Change-Id: Ie7e6e34eb234468d4a255e438b9551c81a9d2fe2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90459 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-04vcl: rename GetContext to GetReaderContext in GraphicTomaž Vajngerl
GetContext is a very generic method name, so rename it to a more specific GetReaderContext name. It is easier to find references. Change-Id: Ieb05ac63080598357107dc3e485b481910cd79cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89929 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-02-11move GraphicReader class out of graph.hxxTomaž Vajngerl
Change-Id: Id78995bfb8e8308a388ed542690ad85e4d19ce12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88425 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-11-03make some classes module-privateNoel Grandin
improve the script, but it still generates some false positives Change-Id: If8ee1cba8c04ac0be11f73220149e6de15f24f44 Reviewed-on: https://gerrit.libreoffice.org/81929 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-24Use lazy-loading stock Image to simplify framework image lists.Michael Meeks
Project stock names through XGraphic via origin URL. (cherry picked from commit 77b88eebaadebb626108172e4f2de36c60960051) Change-Id: Ib445694f7c142a163ef7e7bc0beea39b88b99e14 Reviewed-on: https://gerrit.libreoffice.org/79420 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2019-08-26loplugin:returnconstval in new pdf codeNoel Grandin
Change-Id: I11fdc9a0dcf745dacd516cfc8540a8fb67c45b6c Reviewed-on: https://gerrit.libreoffice.org/78106 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-25sd: unit-test to check that PDF stream is shared among Graphic instancesAshod Nakashian
Reviewed-on: https://gerrit.libreoffice.org/70162 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com> (cherry picked from commit d3a9bdd982ad1ed17cb6fef91885fc4dcf442fdb) Change-Id: Iebd85e5e60c76e6d0756d15e1fa6107a3fcc837d Reviewed-on: https://gerrit.libreoffice.org/77693 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2019-08-25pdfium: Returning a const std::shared_ptr<...>& is not recommended.Jan Holesovsky
Change-Id: Iff6acef712c5b95c8cc222fc5293c9304b1c03ec (cherry picked from commit c0a3f61ef5c42d6cfa7484a2c759e7638da2c096) Reviewed-on: https://gerrit.libreoffice.org/77692 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2019-08-25pdfium: Use std::vector to hold the PdfData.Jan Holesovsky
This fixes the destruction of the static cache of the PDF data; without this, there were already missing uno runtime info. (cherry picked from commit 20055ebe1b27f716a2acf1f0f4dda2864ae811bf) Change-Id: I877c9ccf96c4b7eabf3d643e17f324d86d987f94 Reviewed-on: https://gerrit.libreoffice.org/77691 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2019-08-23Mark move ctors/assignments noexceptMike Kaganski
This should enable using move semantics where possible e.g. in standard containers. According to https://en.cppreference.com/w/cpp/language/move_constructor: To make strong exception guarantee possible, user-defined move constructors should not throw exceptions. For example, std::vector relies on std::move_if_noexcept to choose between move and copy when the elements need to be relocated. Change-Id: I6e1e1cdd5cd430b139ffa2fa7031fb0bb625decb Reviewed-on: https://gerrit.libreoffice.org/77957 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
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-05-22tdf#120837 File saving at least 5 times slowerNoel Grandin
The problem here is that we never actually hit the maExportGraphics cache in SvXMLGraphicHelper, even though we are passing the same image down repeatedly. There are two bugs here: (1) BitmapEx::operator== does not return true if we instantiate 2 Graphic objects from the same XGraphic, so change it to use the more expensive operator==. To mitigate the cost, move the expensive checks to the bottom of the method. (2) in order to use an object in std::unordered_map, the object must implement an equality function and a hash function. If two objects are equal THEY MUST have the same hash value. Using the Impl* as the hash value does not satisfy that condition, so rather use the checksum, which does. After these fixes, the save time drops to less than a second. Also make the checksum method look more like the operator== method, and add a checksum calculation method for SVG data that more accurately reflects the underlying SVG data. Change-Id: I4ca0c7bee60b2efa6fe42301e582c7b278022b46 Reviewed-on: https://gerrit.libreoffice.org/72615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-30drop Graphic::operator boolNoel Grandin
which tends to interact in very weird ways with other code, for example it makes Graphic appear to have an operator< Change-Id: I335fe8f3644b710bc61291e625cbca7334a37716 Reviewed-on: https://gerrit.libreoffice.org/71532 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-28rename animate.hxx to animate/Animation.hxx, more changes followTomaž Vajngerl
This is the first step of refactoring Animation where it is needed to separate AnimationBitmap(s) from the Animation class, which is also responsible for displaying of animation. General idea is to make Graphic work only with AnimationBitmaps, which can be freely be swapped out and in, make copies - all transparantly from the actually displaying them and possibly it will also remove the need to copy the animation objects. Change-Id: If5d55ac1a5b26c3880d4f7602be57742b086f9da Reviewed-on: https://gerrit.libreoffice.org/71406 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
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-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-06-18vcl: share GfxLinkAshod Nakashian
When importing PDF as images, we store the PDF stream in the GfxLink. For large PDFs storing a copy of the full PDF with each page is overkill. For example a 10MB PDF with 200 pages will consume 2GB of memory! Change-Id: I99913514cf5c562683080bc817668095bee69427 Reviewed-on: https://gerrit.libreoffice.org/55571 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2018-06-07vcl: svx: misc improvements to pdfium importingAshod Nakashian
Change-Id: I58f2fd973a731b148f40b37139cd74bac097a7d2
2018-06-07sd: import PDFs as images using Pdfium new SdPdfFilterAshod Nakashian
LOK now opens PDFs as images using Pdfium, which has a superior accuracy and support to poppler, the default pdf reader. Change-Id: Ifbbecf7f048f001836fb98886705cba47e6bed4e
2018-06-07pdf: share pdf data in GraphicAshod Nakashian
Change-Id: I8146aa4e206788afff71142e1877fd7a885f4652
2018-05-31drop Graphic::GetBitmapNoel Grandin
so that we flush out various code using Bitmap, in favour of using BitmapEx. This is part of the process of making Bitmap largely an internal detail of vcl Change-Id: Iaf2ead5e3d9960838723fb55b812b97108093d74 Reviewed-on: https://gerrit.libreoffice.org/55062 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-04-16Make linked graphic register into LinkedManager againTomaž Vajngerl
Change-Id: I16b162f86d6221d120f6355f9a52c1abfcd0ac73 Reviewed-on: https://gerrit.libreoffice.org/52911 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-04-10graphic: rename Set{Get,Is}Link to Set{Get,Is}GfxLinkTomaž Vajngerl
The main reason is to differentiate when we have the GfxLink from other (url, file) links which use the same terminology. Change-Id: I805c61e7fb231062340562c51c25a189b2cfc7f7 Reviewed-on: https://gerrit.libreoffice.org/52245 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-04-10remove swapping and link from GraphicObject and GraphicTomaž Vajngerl
Change-Id: If81127e0589b504909801bcbf392d2dec3a3efc1 Reviewed-on: https://gerrit.libreoffice.org/52244 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-04-10vcl: detach usage and remove GraphicManager and GraphicCacheTomaž Vajngerl
Also remove some GraphicObjectTest because they call into GraphicManager which now doesn't exist anymore. Change-Id: Ia434736d8611df629af3e897c878a7fb8bbe4706 Reviewed-on: https://gerrit.libreoffice.org/52243 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-02-26bool cast operator for Graphic objectTomaž Vajngerl
Change-Id: Iec236538271b33eb9e6dcfd98903657c1198476e Reviewed-on: https://gerrit.libreoffice.org/50332 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-02-11Add origin URL to Graphic to remember where the image came fromTomaž Vajngerl
Change-Id: I73e7377c2049211de0b464efff03058dc5de33a6 Reviewed-on: https://gerrit.libreoffice.org/49554 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-02-01hash implementation for Graphic objects, for set/map useTomaž Vajngerl
Change-Id: I58547ad90d1aba6b1734a547c8138d1476c4b813 Reviewed-on: https://gerrit.libreoffice.org/49072 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-08-17remove UL/L suffixes from integer constants on the RHS of expressionsNoel Grandin
Change-Id: I899a8126c9d971601fea6c77eca165718aea0ac5 Reviewed-on: https://gerrit.libreoffice.org/41237 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-27make animation loop sal_uInt32 consistentlyCaolán McNamara
all this foo is ultimately animated gifs and the count there is limited to unsigned 16bit Change-Id: Ib6e6dde7355f3619bb7735743e686e6338a235ee
2017-07-15emfplus: create a wmf/emf/emf+ primitive based importerArmin Le Grand
First steps to organize an importer that can read/interpret wmf/emf/emf+ and deliver a primitive representation for the content by parsing it. Use the same mechanisms as already applied for Svg, so to reuse abilities to keep original binary data to allow save again and embedding in files and have an implemented replacement bitmap based representation. For this, unify the used helper classes to handle more than just Svg. For 1st try, add test code and static bool switches Change-Id: I6e0a82943541d811a8f8d65a84115569fcd8cee7
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>
2017-04-25tools: svstream.hxx needs only errcode.hxx & not errinf.hxxChris Sherlock
Change-Id: Ia28e35ae5af4f601e9a586a3deffbcd61702b0ca Reviewed-on: https://gerrit.libreoffice.org/36896 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-01-13new loplugin: useuniqueptr: vclNoel Grandin
Change-Id: Idcbc8655108ff57c06c33bbcabd652387bf3c4ec Reviewed-on: https://gerrit.libreoffice.org/32948 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-10defaults are good enoughCaolán McNamara
Change-Id: I4520e00b8c48938a4ff1ed89e3c61948d886972c Reviewed-on: https://gerrit.libreoffice.org/32889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-01-09Related: coverity#1371305 unnecessary inheritenceCaolán McNamara
SvDataCopyStream used to do extra Load/Save things that are long gone, so there is no reason for the common base anymore Change-Id: Ib321021002adb480bb96298f199141dc3fe2ec2b Reviewed-on: https://gerrit.libreoffice.org/32851 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-01-01noone cares about the return from WriteGraphic eitherCaolán McNamara
Change-Id: Ia91a8b4ae7768bd1623b8e2b545fcc9beff1fbc7