summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
AgeCommit message (Collapse)Author
2019-10-02tdf#127913 crash applying popart filter to an imageNoel Grandin
regression from commit 1cd32bcf1b92bd53320717626601135623dadd55 Date: Mon Dec 10 11:28:59 2018 +0200 loplugin:useuniqueptr in vcl where I failed to note that sort needs a different kind of comparator to qsort. Also fix another similar issue I introduced in that commit Change-Id: I5a93bd0567cd5dd4344b9cf2c362ebff60fa0027 Reviewed-on: https://gerrit.libreoffice.org/80007 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:constmethod in vclNoel Grandin
Change-Id: I6a456979a6cfcd7920dc468baf9b23013cb701a4 Reviewed-on: https://gerrit.libreoffice.org/79783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-09use unique_ptr in OctreeNoel Grandin
Change-Id: I18d5eb7d63371690de3fd1e8e512bfe4d603078c Reviewed-on: https://gerrit.libreoffice.org/78707 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-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-24cid#1451629 silence Division or modulo by zeroCaolán McNamara
Change-Id: I87f59593d7a1691d07276421aaa501751b4953e5 Reviewed-on: https://gerrit.libreoffice.org/76226 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-22cid#1448542 Unintended sign extensionCaolán McNamara
Change-Id: I8673f177a0ae6fe9bfd6e2ee7a87f80b058bb24f Reviewed-on: https://gerrit.libreoffice.org/76104 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-20cid#1448542 Unintended sign extensionCaolán McNamara
Change-Id: I5ef8661a1c8e28537c96cb899d124012938f4b1f Reviewed-on: https://gerrit.libreoffice.org/76017 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-19cid#1448308 Unintended sign extensionCaolán McNamara
Change-Id: I3d89afa66dc42144f0717c34593d48c4869aeec4 Reviewed-on: https://gerrit.libreoffice.org/75923 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-19loplugin:constantparamNoel Grandin
and tweak the plugin to handle a crash seen with clang-9 Change-Id: Ie1ccf80c16a20dbca58e5bd081af13f75cf5ac8f Reviewed-on: https://gerrit.libreoffice.org/75850 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-02tdf#42949 Fix IWYU warnings in vcl/source/[a-e]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I386e913f9002eed164c26137a0e184993d010b86 Reviewed-on: https://gerrit.libreoffice.org/74090 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-06-29tdf#125873 Selected border color preview isn't shownNoel Grandin
Regression from commit 319c57d2af5d26d3910db4b02dca145d8881af tdf#120837 File saving at least 5 times slower which made BitmapEx::operator== rely more heavily on Bitmap::operator==, which in turn relies on the platform-specific SalBitmap subclass to calculate a checksum, which was not happening with WinSalBitmap. Consequently, make Bitmap::operator== more robust by returning false if either of the underlying bitmaps cannot generate a checksum Change-Id: Iad8a4ce19544839a6303f0e8d006b138c2d75a31 Reviewed-on: https://gerrit.libreoffice.org/74834 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-25tdf#125892 improve time to export PDF, use int ops for scalingNoel Grandin
The time here is all in the nice rescaling we do these days. Speed it up by using int ops instead of float ops. This takes the time from 5m to 1m30 for me. Change-Id: Ic1dcd9e49eef1894f4a4fdb416015b69c6ef96da Reviewed-on: https://gerrit.libreoffice.org/74689 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-13Make BitmapColor inherit from / merge into ColorJan-Marek Glogowski
BitmapColor itself is kept to distingish the Color usage as part of a color palette, which continues to store the offset in the blue value. The original special mbIndex handling is long gone since commit 1fefdd6f3b41 ("Alpha channel in BitmapColor - change bIndex to alpha"), so there is no data difference. This also results in the following changes: * now has a basic_ostream<charT, traits>& operator<< (that was my actual starting point... for an other bug fix) * there is a minimal difference for GetLiminance BGR(29,151,76) => BGR(28,151,77) * no more return values for Merge and Invert (previously returning *this) * replaces all GetBlueOrIndex with GetIndex This leaves one "problematic" part: the GetColorError handling. At first glance it should probably be virtual. The Color variant is less strict then the BitmapColor one - for whatever reason. BitmapColor is always used to search for the best match in a Palette. Currently I'm simply leaving both variants. Would be nice to have an explict for functions here. Change-Id: I251ba3024a1d60f2a9d9fde9cd0a60f08e8322a7 Reviewed-on: https://gerrit.libreoffice.org/72181 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-05-01Typo Pallete->PaletteJulien Nabet
Change-Id: I8a7be3738cd84699568ae2711367e49754401609 Reviewed-on: https://gerrit.libreoffice.org/71594 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-30tdf#125014 only use a fastpath if src. and dest. bitcount matchesTomaž Vajngerl
It can happen that a bitmap is 32-bit (made from a VirtualDevice) but we can't even create a 32-bit bitmap ourselves. In that case we can only create a 24-bit, but now we can't use the fastpath anymore as the bitdepth of source and destination is not the same. Fix this by making sure the general scaler will be used when source and destination bitmaps don't have the same bitcount. Change-Id: Icdb974093558d618b7c056b29963b45ee31ce200 Reviewed-on: https://gerrit.libreoffice.org/71540 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-29optimise ImplScaleConvolutionVer a littleNoel Grandin
cache the reading of the source scan line, and use sal_Int32 for pixels and counts (long is 64-bit on 64-bit linux) Change-Id: Iaa0abc3ed3316d3137184b0c051612874885ddf4 Reviewed-on: https://gerrit.libreoffice.org/71462 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-28prefix member variables of AnimationBitmapTomaž Vajngerl
Change-Id: Ic84773399c95d61f843e4388fe01d00cd4facc5a Reviewed-on: https://gerrit.libreoffice.org/71425 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-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>
2019-04-17remove or change salbtype.hxx includesTomaž Vajngerl
Change-Id: Ibd28b8fa92e98ebeb482a9081fbeae24defe4adb Reviewed-on: https://gerrit.libreoffice.org/70826 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-15move ImpNodeCache into Octree.cxx and clean-upTomaž Vajngerl
ImpNodeCache is specific to Octree so it's best that it lives near the source. Change-Id: I35e937343312b0ab18ed1a4dcaa067ea01a0191f Reviewed-on: https://gerrit.libreoffice.org/70736 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-14Octree: more clean-up, avoid memset, prefix member varsTomaž Vajngerl
Change-Id: I79ec1d0176f523d16c53220de9b0a0d9819729ea Reviewed-on: https://gerrit.libreoffice.org/70729 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-14put Octree classes out of formatting blacklistTomaž Vajngerl
Need to do this so it is at least somewhat formatted sanely before refactoring to the data structures. Change-Id: I136a539a190c2f53aa05cc9a26872a5606f81888 Reviewed-on: https://gerrit.libreoffice.org/70727 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-14move octree to bitmap folder, and *octree headers to inc/bitmapTomaž Vajngerl
Octree is a tree, that's used for color quantization, so it's better to move it there. Headers are also moved to bitmap subfolder so it's better organized. Change-Id: I2b84a5469c1479cf0a060ba8eb46591dabab2883 Reviewed-on: https://gerrit.libreoffice.org/70726 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-13BitmapScaleSuper: rename the func. names to reflect what they doTomaž Vajngerl
Functions that scaled down had "2" at the end of the name so we could distinguish them from the scale up functions. This was hard to tell them apart, so rename the functions to reflect what they do. Change-Id: I9d88b86312e80b111439f1022212de07e53485d5 Reviewed-on: https://gerrit.libreoffice.org/70696 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-13BitmapScaleSuper: generalize 24bit scalingTomaž Vajngerl
Until now we had RGB and BGR version. Because we never change the byte order when scaling and the scanline type, we can generalize the two funcions into one, where we only need to be careful that we don't change the order of color components. The same is done already for 4 variants of 32-bit bitmap, where we really only need 1 function for all 4 variants, using the same principle. Change-Id: I0f6d6b0c06a45e53bcd048e2ae009a471bf90a06 Reviewed-on: https://gerrit.libreoffice.org/70695 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-13BitmapScaleSuper: make it easy to change the percisionTomaž Vajngerl
Most calculations work with integers for speed, which sacrifices some bits of an integer type for decimal values (fixed-point precision). In this case we used 7 bits for decimal values. This change makes the precision easily adjustable. In addition the actual type of bilinar weights, which was until now the type long (that hasn't a standardized bit length), but is now changed to sal_Int32 (so we know exactly how much bits we can use) and can be changed to sal_Int64 in the future if necessary by just adjusting the typedef. Change-Id: I8d41751c20e14cd1b9b64b055ff66bd1ca7c9f1d Reviewed-on: https://gerrit.libreoffice.org/70694 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-13tdf#124543 add functs. to scale 32bit bitmaps to BitmapScaleSuperTomaž Vajngerl
We still miss the support in other function however. Change-Id: Ie87b588a9f8826242f4cff9d6671c98f3407f0e3 Reviewed-on: https://gerrit.libreoffice.org/70679 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-13Improve multi-threaded scaling in BitmapScaleSuperFilterTomaž Vajngerl
The old approach was to calculate the number of stripes of the bitmap per thread and later create the exact number tasks (ScaleTask) as there are threads, where each task would process stripes it had been given. This is needlesly complicated as the job of a thread pool is to properly delegate the tasks between threads. This was now changed so that we create one stripe per ScaleTask and let the threadpool delegate the tasks to its threads (that are available). It also wanted to be clever and use the main thread to do the work also, but it had a major flaw. The threadpool started to process the tasks only when "waitUntilDone" method was called, but the code first processed its slices and then called the threadpool method to start processing. Because of this the performance of scaling wasn't as good as it could be. This behaviour was now changed so that the main thread isn't involved in processing. It just creates the task, runs the threadpool and waits until the tasks are finished. Change-Id: I1e8c733bdbced8867d0a7f1190f0421a0cc3e067 Reviewed-on: https://gerrit.libreoffice.org/70668 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-09remove some usages of BitmapColor outside of VCLTomaž Vajngerl
You get BitmapColor only from reading pixels from a Bitmap and we want to avoid usage of Bitmap outside of VCL (and use BitmapEx as the alternative which will eventually replace Bitmap). Change-Id: Iddfa3ef739bfdd4dce5fb47fd9f67a5a36f3388b Reviewed-on: https://gerrit.libreoffice.org/70447 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-04Revert "raise cairo baseline to 1.12.0"Caolán McNamara
This reverts commit 50580f452cc7c88a231831619a3f05958ce56460. Revert "raise cairo baseline to 1.10.0" This reverts commit 58a0e60dee0d27a699f856827c20b792417d3478. 32bit baseline is currently at cairo 1.8.8 Change-Id: I5156df6aee03dbbb2e209dbd5717a98580256170 Reviewed-on: https://gerrit.libreoffice.org/70260 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-04-04change GetColorCount to use sal_Int64Tomaž Vajngerl
Hopefully fixes problems on 32-bit linux. Change-Id: I1fc22f1bb37c8297bd3bd6828206d1ffa9ae722d Reviewed-on: https://gerrit.libreoffice.org/70241 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-04raise cairo baseline to 1.12.0Caolán McNamara
Change-Id: I1816f23fea88e6b840539a88504956b00a546522 Reviewed-on: https://gerrit.libreoffice.org/70243 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-04-03Support for native 32bit Bitmap in VCL and SVP (cairo) backendTomaž Vajngerl
This adds basic support for 32bit bitmaps for the SVP backend. For other backends the support is disabled for now as we need to add it for each backend separately and enable support. When this patch is applied it is possible to a Bitmap with bit count 32, but currently no input filter uses this with the exception of the new PngImageReader(libpng based), which is used only for the icons. For a general support more things need to be implemented and tested: - conversion back and fourth between 32-bit and 24-bit + 8bit alpha (or other supported pairs) - 'raw' export of the bitmap needs to be handeled properly (like in SVM import/export) so it creates the correct image. - input filters need to be checked and converted if this is necessary - look for possible bugs when drawing transparent bitmaps - check of UNO API Change-Id: I7a7be0e6134dfdd9a7aeaef897131bb6e710ae7e Reviewed-on: https://gerrit.libreoffice.org/69289 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-02-14don't need a special function to get the BlueOrIndex colorTomaž Vajngerl
Change-Id: Idee5a82f8b69a25afa603ce8743d071d0093d617 Reviewed-on: https://gerrit.libreoffice.org/67824 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-02-13Improve the algorithm of disabled image creationTomaž Vajngerl
Main change is to not change alpha channel at all. For RGB channels, calculate the luma value and map the value into 160-224 range. Much simpler and better result. Change-Id: Ied108c2135f98d78f230a2c0b305bd3396d9ccfd Reviewed-on: https://gerrit.libreoffice.org/67791 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-02-07tdf#123165 cache recently scaled bitmaps for reuseCaolán McNamara
dropping the cached scaled bitmap when the bitmap is accesed via BitmapAccessMode::Write for writing Change-Id: Ib6539522944838238bd699ec3531039d21dc0f8b Reviewed-on: https://gerrit.libreoffice.org/67459 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-01-23loplugin:constparams in vclNoel Grandin
Change-Id: Icf1a952fbe190fd6c4efd89364136aa2b48050e3 Reviewed-on: https://gerrit.libreoffice.org/66767 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-11Drop o3tl/clamp.hxx, use C++17 std::clamp insteadStephan Bergmann
Change-Id: I5043c787dcc3b78bc7fdff130564801194e39f46 Reviewed-on: https://gerrit.libreoffice.org/66177 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-19Removed useless semicolonsAndrea Gelmini
Change-Id: I6efd221e71020030ae5b8ac8800f72e42b13aa28 Reviewed-on: https://gerrit.libreoffice.org/65390 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-12-11loplugin:useuniqueptr in vclNoel Grandin
Change-Id: I24eca813321fd3919bba9d37c285484f865ea2ea Reviewed-on: https://gerrit.libreoffice.org/64877 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-10tdf#42949 Fix IWYU warnings in include/vcl/s*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ie87d27dd2c385a63349e0b322fd067ba03d2d152 Reviewed-on: https://gerrit.libreoffice.org/64479 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-05Revert "Compute (un-)premultiply_table at compile time"Stephan Bergmann
This reverts commit 644188bf7f3a07222f2b58a3794348197fb8ad24. It has been found to cause compilation failure ("vcl/source/bitmap/BitmapTools.cxx(1078): error C2131: expression did not evaluate to a constant") with Visual Studio 2017 version 15.9, as discussed in the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2018-December/081500.html> "Windows build failure - C2131: expression did not evaluate to a constant" (and Mike thankfully filed a bug upstream, <https://developercommunity.visualstudio.com/content/problem/398218/ c2131-error-with-stdarray-and-stdmake-integer-sequ.html>). Also, Jenkins node tb39 which runs the "Gerrit Windows" sub-job of Jenkins' "Gerrit for master" job apparently has such a Visual Studio 2017 version 15.9 installed, so keeps failing that job. Change-Id: I87d25863f2e07474fbb2df3c8f72cd2bcc89582e Reviewed-on: https://gerrit.libreoffice.org/64618 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-05loplugin:unnecessaryparen include more assignmentsNoel Grandin
Change-Id: I9fb8366634b31230b732dd38a98f800075529714 Reviewed-on: https://gerrit.libreoffice.org/64510 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-03Compute (un-)premultiply_table at compile timeStephan Bergmann
Change-Id: I34e624fcd5d11d02c26e775f5acdddec1fca9d87 Reviewed-on: https://gerrit.libreoffice.org/64428 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-02use same [un]premultiplyCaolán McNamara
Change-Id: Idd1ca1243b64a9ec606382a0895e11376a2ec186 Reviewed-on: https://gerrit.libreoffice.org/64406 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-11-29tdf#42949 Fix IWYU warnings in include/vcl/[i-m]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If1b2e04872eb0dd6725802c1709a9085f4cd8c91 Reviewed-on: https://gerrit.libreoffice.org/64141 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-28loplugin:unusedfieldsNoel Grandin
Change-Id: Iffbb4e7107a0b1ae35c879c193a9ec209addf453 Reviewed-on: https://gerrit.libreoffice.org/64144 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-21tdf#42949 Fix IWYU warnings in include/vcl/[B-E]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Iabe571aa8f00492902c499094bea8365a3e17fca Reviewed-on: https://gerrit.libreoffice.org/63623 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-19tdf#42949 Fix IWYU warnings in include/vcl/[ab]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If18c80fc64e55d797953e24e40e5d5e62bd9c625 Reviewed-on: https://gerrit.libreoffice.org/63453 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>