summaryrefslogtreecommitdiff
path: root/include/vcl
AgeCommit message (Collapse)Author
2021-10-12loplugin:unusedmethodsNoel Grandin
Change-Id: Ifd3a1ccef68ebc4cd4e7785357e6a476f6669eb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123456 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11In O[U]StringBuffer, make string_view params replacements for OUString onesStephan Bergmann
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-10fix (cppunit test) build with --enable-mergelibsRene Engelhard
S=/home/rene/LibreOffice/git/master && I=$S/instdir && W=$S/workdir && /usr/bin/ccache x86_64-linux-gnu-g++ -pthread -shared -Wl,-z,noexecstack -Wl,-z,origin '-Wl,-rpath,$ORIGIN/../Library' -Wl,-rpath-link,$I/program -Wl,-z,defs -Wl,-rpath-link,/lib:/usr/lib -Wl,-z,combreloc -Wl,--hash-style=gnu -Wl,-Bsymbolic-functions -L$W/LinkTarget/StaticLibrary -L$I/sdk/lib -L$I/program -L$I/program -L$W/LinkTarget/Library -Wl,-z,relro $W/CxxObject/vcl/qa/cppunit/BackendTest.o -Wl,--start-group -lcppunit -Wl,--end-group -Wl,--no-as-needed -lmergedlo -luno_cppu -luno_cppuhelpergcc3 -luno_sal -ltest -lunotest -o $W/LinkTarget/CppunitTest/libtest_vcl_backend_test.so /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawPixel()': ././vcl/qa/cppunit/outdev.cxx:1091: undefined reference to `typeinfo for MetaPixelAction' /usr/bin/ld: /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawRect()': ././vcl/qa/cppunit/outdev.cxx:1203: undefined reference to `typeinfo for MetaRoundRectAction' /usr/bin/ld: /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawEllipse()': ././vcl/qa/cppunit/outdev.cxx:1225: undefined reference to `typeinfo for MetaEllipseAction' /usr/bin/ld: /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawPie()': ././vcl/qa/cppunit/outdev.cxx:1243: undefined reference to `typeinfo for MetaPieAction' /usr/bin/ld: /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawChord()': ././vcl/qa/cppunit/outdev.cxx:1263: undefined reference to `typeinfo for MetaChordAction' /usr/bin/ld: /home/rene/LibreOffice/git/master/workdir/CxxObject/vcl/qa/cppunit/outdev.o: in function `VclOutdevTest::testDrawArc()': ././vcl/qa/cppunit/outdev.cxx:1284: undefined reference to `typeinfo for MetaArcAction' Change-Id: I65f79d726de553d894c848a89cf1dd97d5e45b54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123329 Tested-by: Jenkins Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-10-08vcl: test PhysicalFontCollection and move to vcl::font namespaceChris Sherlock
- tested PhysicalFontCollection, noted odd behaviour with search names and normalization - moved PhysicalFontCollection.hxx to vcl/inc/font - moved PhysicalFontCollection into vcl::font namespace Note that I needed to regenerate the pch file otherwise errors were generated. Change-Id: Ifa0c7b871c40687bd15002565d2f7a3e408218f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122036 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-08loplugin:moveparam in vclNoel Grandin
Change-Id: I6dea009e1031174ecb3d4371e91c9c6d26c6e514 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123245 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-08loplugin:moveparam in vclNoel Grandin
Change-Id: Ic43e02576454e3ee174304db350659dd113a1d5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123186 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-06vcl: test OutputDevice::DrawPixel()Chris Sherlock
Change-Id: I82651c6f41f46bb1097a69f3bcddcac2486a5baa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122794 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-10-06vcl: remove unused class ImplDeviceFontSizeListChris Sherlock
mpDeviceFontSizeList is no longer used in OutputDevice, so remove this member variable, and then remove ImplDeviceFontSizeList. Change-Id: I93353909485a9243ae02d44c2adc1c9c4a769cef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123125 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-05vcl: test PhysicalFontFace and move to vcl::font namespaceChris Sherlock
- moved PhysicalFontFace.hxx to vcl/inc/font - added PhysicalFontFace to vcl::font namespace - had to regenerate precompiled_vcl.hxx - tested PhysicalFontFace, with some extensive tests for IsBetterMatch() Change-Id: I860022ac244f8a827f6f9cb7ed9018c5d9c328cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121970 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-04Related: tdf#141633 similiarly support match combo/listbox font sizesCaolán McNamara
to the desired zoomed font size in the table control Change-Id: Iaf3b004544fdb0311b6c67baad612ba648e8c546 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123043 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.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-09-30vcl: initialize variables in ImplMapRes declarationChris Sherlock
Change-Id: I379a555c8e148ba0294198fb5e12582f73a51554 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122771 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-30loplugin:constparams improve handling of pointer paramsNoel Grandin
Change-Id: I4c0002e72703eded435bfe4985f5b0121bf8524b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122843 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30Related: tdf#141633 support setting a custom font for TextViewCaolán McNamara
Change-Id: I4c27a21c5c682fc73c37594749627e4cc7c0822d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122833 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-30vcl: remove MetaActionType param from DrawBitmap/DrawBitmapEx/DrawMaskChris Sherlock
This is needed to allow for a clean abstract class DrawingInterface, which I will introduce in a followup patch. Change-Id: I1bb631872e44a82094dcfff07c0f418e9a4a0224 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122614 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-28gives names to all the Idles and TasksNoel Grandin
enforce it by making the constructor parameter non-default. Change-Id: I321543e4dcf15ea0a43ad8cce91d2f8dc22df6ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122766 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-28vcl: rename OutDevState to StackChris Sherlock
I have moved the header file to include/vcl/rendercontext as this will eventually be part of the RenderContext split from OutputDevice. State and associated enums have also been moved to the vcl namespace. I have also moved ComplexTextLayoutFlags into the vcl::text namespace. Change-Id: I0abbf560e75b45a272854b267e948c240cd69091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121524 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-27WIN lazy init WinSalInfoPrinter graphicsJan-Marek Glogowski
... and while at it make stuff private and add _ to the newly private member variables. The new assert revealed a bug in the SalGraphics refcounting, because the virtual ReleaseGraphics is called from the destructor, which was probably also the reason for the HACK and comment in Printer::ImplReleaseFonts. Change-Id: I7af0bda19be6810dd8c0ea5b74604381e2047407 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122371 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-09-23WB_DEFAULTWIN should be sufficient to flag that no icon is requiredCaolán McNamara
Change-Id: Ibb5d8331d5d47e2b5c163c2797b2e7b5cee4b285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122517 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23tdf#144624 Prevent infinite recursion when loading SVG iconAleksei Nikiforov
When Generic/X11 VCL backend plugin loads SVG icon, it creates virtual device for rasterizing an SVG icon, which in turn tries to load an SVG icon, and thus infinite recursion happens. Change-Id: I7559b6255e6718e64ef4a6e7c79d597375e5823a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122344 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23put vcl::Region operator<< in the vcl namespaceLuboš Luňák
Clang says it belongs there when vcl::Region is used in CPPUNIT_ASSERT_EQUAL. Change-Id: I457d7b35e9b2ca37909118467da8018d40ab18a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122461 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-22Extend loplugin:stringviewparam to starts/endsWith: vclStephan Bergmann
Change-Id: Ic208697fd985da223819d203e67325b03028fca5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122469 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-21vcl: remove OutputDevice's GetDevFontSizeCount() and GetDevFontSize()Chris Sherlock
The OutputDevice::GetDevFontSize() function is only used for non-scalable (bitmap) fonts. We have stopped supporting bitmap fonts since LO 5.3, see tdf#103514: Support for bitmap-only fonts on Windows has been removed (Khaled Hosny) I found the following when removing PhysicalFontFace::SetBitmapSize(): 1. as mnHeight and mnWidth and not set by anyone, I realized I could remove them, which meant removing GetHeight() and GetWidth() 2. PhysicalFontFamily::GetFontHeights() populates heights from the collection of font faces into a sorted vector of font heights taken from PhysicalFontFace. As this no longer exists this function serves no purpose, it has been removed. 3. PhysicalFontFamily::GetDeviceFontSizeList() calls upon PhysicalFontFace::GetFontHeights(). This function takes this sorted list of font heights, and then populates and returns a new list of sizes (or rather, heights). As the heights aren't available any more, this function is also unneeded, so it has been removed. 4. OutputDevice::GetDevFontSizeCount() calls upon PhysicalFontFamily::GetDeviceFontSizeList(). This function has the side effect of initializing the list of fonts. 5. When I checked what calls on GetDevFontSizeCount(), there is only one caller - FontList::GetSizeAry() in svtools. The function returns a standard font size list if the family name is empty, or there are no font sizes (via OutputDevice::GetDevFontSizeCount()). As this will *always* be empty (see chain above) then this function just needs to always return a standard font size list. Thus OutputDevice::GetDevFontSizeCount() and GetFontSizeList() are no longer called upon by anything, so they can be removed. 6. svtool's FontList::GetSizeAry() no longer uses the FontMetric parameter, so this has been removed from the function signature, and cleanup done of the function that calls upon it in svtools, framework, editeng, and desktop. A number of variables that were no longer used due to this change were also removed. 7. This change removed the need for the mpSizeAry unique_ptr in FontList. ImplFontListFontMetric::GetDevice() and mpDevice could also be removed as it was no longer used anywhere. 8. After simplifying GetSizeAry(), it turns out it was the same as GetStdSizeAry(), so removed FontList::GetSizeAry() and used FontList::GetStdSizeAry() in its place. 9. Changing to use GetStdSizeAry() revealed that FontSizeBox::Fill() no longer used the pFontMetric paramter, so this was removed, and call sites updated. 10. Due to change to Fill(): a. SvxFontSizeBox_Base::UpdateFont() no longer uses the const css::awt::FontDescriptor& rCurrentFont parameter, so removed this. This also removed the member variable m_aCurrentFont b. SvxCharNamePage::FillSizeBox_Impl() had a number of newly unused variables removed. c. SwStdFontTabPage::Reset() and SwStdFontTabPage::LoseFocusHdl() had a number of newly unused variables removed. Change-Id: If840e240155c36ed351c63e3136b5b44bb058697 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121932 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-21vcl: add sal/config.h in preparation for patchChris Sherlock
The convention is that we need to add sal/config.h to the start of files. This patch is created in preparation of a patch I have queued to test and move PhysicalFontFace to vcl::font namespace. Change-Id: I15dd24d7f01e077d407ac192a0413d796517eb72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122228 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-20tdf#124176 - Use pragma once instead of include guardsChris Sherlock
This patch is created in preparation of a patch I have queued to test and move PhysicalFontFace to vcl::font namespace. Change-Id: I805a8bd1fa881fc4bc6d2f26f1051b9247587701 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122226 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-09-20Add sal/config.h in preparation for patchChris Sherlock
The convention is that we need to add sal/config.h to the start of files. I have a patch queued to be able to create a FontMetric from a PhysicalFontFace. Submitting this patch so I can hopefully one day land this patch. Change-Id: I5817acd6e194da576f2c8a13539d38954a4f4e15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122172 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-18tdf#124176 - Use pragma once instead of include guardsChris Sherlock
I have a patch queued to be able to create a FontMetric from a PhysicalFontFace. Submitting this patch so I can hopefully one day land this patch. Change-Id: I69b980d76f3e104a1784e2bd630a710deb33f8f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122171 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-18vcl: create FontMetric from PhysicalFontFaceChris Sherlock
A FontMetric can be created from a PhysicalFontFace, so setup a constructor that takes a PhysicalFontFace object to instantiate the FontMetric. The OutputDevice functions GetDevFont() and GetDevFontCount() don't necessarily make much sense, so have changed GetDevFont() to GetFontMetricFromCollection() and GetDevFontCount() to GetFontFaceCollectionCount(). Change-Id: I1577679b949a49a7cf1248838786d0f5e84a5245 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121796 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-18vcl: rename ImplDeviceFontList to PhysicalFontFaceCollection and testChris Sherlock
- renamed ImplDeviceFontList to PhysicalFontFaceCollection and moved to own header file - wrote unit test for PhysicalFontFaceCollection Note that this is part of a series of patches where I also move font files into the relevant font directories, and into the vcl::font namespace. Change-Id: I43669137bcd9a9b2a9417b2369a5cb1b93b93733 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121663 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-09-18vcl: add sal/config.h in preparation for patchChris Sherlock
The convention is that we need to add sal/config.h to the start of files. <chris_wot> mikekaganski do you want me to add sal/config.h to cxx files <chris_wot> as well as headers? <mikekaganski> chris_wot: rather ask sberg :) <@sberg> chris_wot, always, always as first include, by convention <chris_wot> thanks, I'll make sure I do this on any files I touch - if that's OK I have a patch queued to rename ImplDeviceFontList to PhysicalFontFaceCollection, which I am adding a test to. Submitting this patch so I can hopefully one day land this patch. Change-Id: I9d74f850745760774a9f8050023f584cf52dc070 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122167 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-18tdf#124176 - Use pragma once instead of include guardsChris Sherlock
I have a patch queued to rename ImplDeviceFontList to PhysicalFontFaceCollection, which I am adding a test to. Submitting patch to update the include guards to pragma once Change-Id: I091817905599089edec1138eeee06ba3dacd6964 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122225 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-17vcl: update vim modelines in preparation for new changeChris Sherlock
I have a patch queued to rename ImplDeviceFontList to PhysicalFontFaceCollection, which I am adding a test to. Submitting patch to update the modelines in the files that I will change in that patch. Change-Id: I3b0b022cbfa7b05dbfbb5c2d03f6d68128c0598f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122232 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-13loplugin:methodcyclesNoel Grandin
Change-Id: Ia14e47b811ca56d8d4517f262e008985d6aebe35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122020 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-11clang:optin.performance.Padding in vclNoel Grandin
Excessive padding in 'class ImplAccelEntry' (13 padding bytes, where 5 is optimal). Excessive padding in 'struct SalQueryCharPositionEvent' (14 padding bytes, where 6 is optimal). Excessive padding in 'struct SalFrameState' (8 padding bytes, where 0 is optimal). Excessive padding in 'struct BitmapBuffer' (10 padding bytes, where 2 is optimal). Excessive padding in 'class GraphicAttr' (10 padding bytes, where 2 is optimal). Excessive padding in 'struct ImplPostEventData' (12 padding bytes, where 4 is optimal). Excessive padding in 'class TETextPortion' (10 padding bytes, where 2 is optimal). Excessive padding in 'struct MapMode::ImplMapMode' (11 padding bytes, where 3 is optimal). Change-Id: I41801e0fd676981cc9f386d814fe2f0ea670a673 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121925 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-10access maPalette via const BitmapBuffer* when in const methodCaolán McNamara
Change-Id: I7bd1fb312ef7122e25c4d19679773d0c1ccab7be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121916 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-10crashtesting: threaded scaling crash on re-export of ooo24840-1.sxw to odtCaolán McNamara
#13 0x00007f1cb843752a in o3tl::cow_wrapper<ImplBitmapPalette, o3tl::UnsafeRefCountingPolicy>::operator->() (this=0x5596086d5968) at include/o3tl/cow_wrapper.hxx:329 __PRETTY_FUNCTION__ = "BitmapColor& BitmapPalette::operator[](sal_uInt16)" #14 0x00007f1cb843752a in BitmapPalette::operator[](unsigned short) (this=0x5596086d5968, nIndex=nIndex@entry=0) at vcl/source/bitmap/bitmappalette.cxx:139 __PRETTY_FUNCTION__ = "BitmapColor& BitmapPalette::operator[](sal_uInt16)" #15 0x00007f1cb849f5f5 in BitmapInfoAccess::GetPaletteColor(unsigned short) const (nColor=0, this=0x5596085989f0) at include/vcl/BitmapInfoAccess.hxx:114 __PRETTY_FUNCTION__ = "const BitmapColor& BitmapInfoAccess::GetPaletteColor(sal_uInt16) const" the mpBuffer member of BitmapInfoAccess is BitmapBuffer* mpBuffer; not const BitmapBuffer* mpBuffer; so mpBuffer->maPalette.foo() calls non-const variants of foo(), (BitmapPalette::operator[](unsigned short) in this case), which is presumably non the expected outcome, as the copy-on-write mpImpl of BitmapPalette unsafely creates a new copy its internals on the first dereference of mpImpl in a non-const method. Change-Id: I1ebb3c67386a9028e5b8bab4b2d1cc5862700aa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121910 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-10BitmapInfoAccess::GetColorMask can return a const referenceCaolán McNamara
Change-Id: I84c18b1d73910aa4c5a269e122f4ae86eb765e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121907 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-10warning: Excessive padding in 'struct OutDevState'Caolán McNamara
experiment with optin.performance.Padding analyzer and tuning AllowedPad to 2 with clang as compiler; export ENVCFLAGSCXX="-Xclang -analyze -Xclang -analyzer-checker=optin.performance -Xclang -analyzer-config -Xclang optin.performance.Padding:AllowedPad=2" and get a report of: OutDevState (13 padding bytes, where 5 is optimal) UIControlOptions (9 padding bytes, where 1 is optimal) Change-Id: I174f6f62d6e32df057d5e0f21d4274166f6ed8c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121812 Tested-by: Jenkins Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-10vcl: move SetLayoutMode() to text.cxxChris Sherlock
Ultimately I hope to reduce outdevstate.cxx to only have push(), pop() and clearstack(), then rename outdevstate.cxx to stack.cxx. Eventually, the plan is to separate metafile processing from rendering. Also add a unit test for SetLayoutMode() and GetLayoutMode() Change-Id: I92cada7bf3d57ca8b84e04308c74428a1a19e775 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121022 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-10vcl: move OutputDevice drawmode functions to outdev.cxxChris Sherlock
Ultimately I hope to reduce outdevstate.cxx to only have push(), pop() and clearstack(), then rename outdevstate.cxx to stack.cxx. Eventually, the plan is to separate metafile processing from rendering. Add unit test for GetDrawMode() and SetDrawMode(). Change-Id: I63948e7e4c332c786487c18c52faa60893f672a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121021 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-09crashtesting: assert making thumbnail on reexport of tdf127770-1.ods to odsCaolán McNamara
convert to B2DPolygon earlier and do scaling on B2DPolygon's doubles #18 0x00007f534e1093bc in ImplLogicToPixel(tools::Long, tools::Long, tools::Long, tools::Long) (n=<optimized out>, nDPI=<optimized out>, nMapNum=<optimized out>, nMapDenom=<optimized out>) at vcl/source/outdev/map.cxx:268 __PRETTY_FUNCTION__ = "tools::Long ImplLogicToPixel(tools::Long, tools::Long, tools::Long, tools::Long)" n64 = <optimized out> #19 0x00007f534e10a4ff in OutputDevice::ImplLogicToDevicePixel(tools::Polygon const&) const (this=this@entry=0x55c3ebbb9f60, rLogicPoly=...) at include/tools/gen.hxx:80 rPt = Point = {x = -794275722273860480, y = 0} i = 0 nPoints = 2 aPoly = {mpImplPolygon = {m_pimpl = 0x55c3e9fdc250}} pPointAry = 0x55c3e9c9b970 #20 0x00007f534e0ff4d4 in OutputDevice::drawPolyLine(tools::Polygon const&, LineInfo const&) (this=this@entry=0x55c3ebbb9f60, rPoly=..., rLineInfo=...) at vcl/source/outdev/polyline.cxx:251 nPoints = 2 aPoly = {mpImplPolygon = {m_pimpl = 0x7f534e0bfde8 <__gnu_debug::_Safe_sequence<std::__debug::vector<OutDevState, std::allocator<OutDevState> > >::_M_invalidate_if<__gnu_debug::_Equal_to<__gnu_cxx::__normal_iterator<OutDevState const*, std::__cxx1998::vector<OutDevState, std::allocator<OutDevState> > > > >(__gnu_debug::_Equal_to<__gnu_cxx::__normal_iterator<OutDevState const*, std::__cxx1998::vector<OutDevState, std::allocator<OutDevState> > > >)+208>}} __PRETTY_FUNCTION__ = "void OutputDevice::drawPolyLine(const tools::Polygon&, const LineInfo&)" aInfo = {mpImplLineInfo = {m_pimpl = 0x55c3eaa4ca68}} bDashUsed = <optimized out> bLineWidthUsed = <optimized out> #21 0x00007f534e0ff3d8 in OutputDevice::DrawPolyLine(tools::Polygon const&, LineInfo const&) (this=this@entry=0x55c3ebbb9f60, rPoly=..., rLineInfo=...) at vcl/source/outdev/polyline.cxx:135 __PRETTY_FUNCTION__ = "void OutputDevice::DrawPolyLine(const tools::Polygon&, const LineInfo&)" #22 0x00007f534e1f1d56 in MetaPolyLineAction::Execute(OutputDevice*) (this=0x55c3e998e300, pOut=0x55c3ebbb9f60) at vcl/source/gdi/metaact.cxx:481 #23 0x00007f534e1be27a in GDIMetaFile::Play(OutputDevice&, unsigned long) (this=this@entry=0x55c3e9e4c700, rOut=..., nPos=86, nPos@entry=4294967295) at vcl/source/gdi/gdimtf.cxx:371 nCurPos = 48 i = 48 pAction = 0x55c3e998e300 nObjCount = <optimized out> nSyncCount = 4294967295 #24 0x00007f534e1be4e1 in GDIMetaFile::Play(OutputDevice&, Point const&, Size const&) (this=this@entry=0x55c3e9e4c700, rOut=..., rPos=Point = {...}, rSize=Size = {...}) at vcl/source/gdi/gdimtf.cxx:512 aDrawMap = {mpImplMapMode = {m_pimpl = 0x55c3e9f338d0}} aDestSize = Size = {width = 756, height = 1020} pMtf = 0x0 aScaleX = {mnNumerator = 756, mnDenominator = 341, mbValid = true} aScaleY = {mnNumerator = 1020, mnDenominator = 461, mbValid = true} rOldOffset = Size = {width = 0, height = 0} aEmptySize = Size = {width = 0, height = 0} bIsRecord = false #25 0x00007f534e1be9c5 in GDIMetaFile::CreateThumbnail(BitmapEx&, BmpConversion, BmpScaleFlag) const (this=this@entry=0x55c3e9e4c700, rBitmapEx=..., eColorConversion=eColorConversion@entry=BmpConversion::N8BitColors, nScaleFlag=nScaleFlag@entry=BmpScaleFlag::Default) at include/rtl/ref.hxx:206 aAntialias = Size = {width = 756, height = 1020} aBitmap = {maBitmap = <incomplete type>, maAlphaMask = <incomplete type>, maBitmapSize = Size = {width = 94299930324064, height = 139995769668141}} aVDev = {<ScopedVclPtr<VirtualDevice>> = {<VclPtr<VirtualDevice>> = {m_rInnerRef = rtl::Reference to 0x55c3ebbb9f60}, <No data fields>}, <No data fields>} aNullPt = Point = {x = 0, y = 0} aDrawSize = Size = {width = 189, height = 255} aSizePix = <optimized out> nMaximumExtent = 256 aAntialiasSize = Size = {width = 760, height = 1024} Change-Id: I4284a7da0684845d7c0af136b25c5210d522c79b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121863 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-08Removed duplicated includeAndrea Gelmini
Change-Id: Icc9747237c4ff23cd844f23531f0de37ca1a37d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121798 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2021-09-08vcl: migrate GetDownsampledBitmap() from OutputDevice to vcl::bitmapChris Sherlock
Change-Id: Iee6caa8292472a3acca66d670a113b701f4b637e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121581 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-08vcl: make GetDownsampledBitmap() take destination size in units of twipsChris Sherlock
This removes the need to use OutputDevice functions, which means we can later move this function to bitmaptools.cxx Change-Id: If547563808c2656d395d4669507f5f8dcfadcabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121580 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-07tdf#142129 vcl: add unit testMichael Stahl
Reportedly bug was fixed by commit 5fc6a601d7a1978db291fd0f7dcec638a7c25651 Change-Id: Iee32cacff0c939bdf498e9dc8102eb2d22a5a1c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121776 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-09-07vcl: rename PrinterOptions to vcl::printer::OptionsChris Sherlock
Move Options to own source and header files. Options moved to own source and header files, however also put Options into vcl::printer namespace. I have renamed and moved PrinterOptions into the vcl::printer namespace because the word "Printer" is redundant, and we want to organize the vcl namespace better. Change-Id: I2ef188af381dd65907d48f7b190e4ab69417606d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121389 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-09-07loplugin:unusedmethodsNoel Grandin
Change-Id: I6295d6ff6fb7410852351801c324244308c5c472 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121751 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-07Related: tdf#142458 don't change border size during PaintCaolán McNamara
so GetOptimalSize/get_preferred_size before/after paint has the same result Change-Id: I25abe31c069561e30a9af7c4b9b81582298e0f9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121616 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-07vcl: followup tdf#74702 vcl: remove GetOutDevType() from ImplNewFont()Chris Sherlock
virtual keyword was missing on ImplNewFont(), without it the previous change effectively removed the PDFWriterImpl code. Thanks to Noel for pointing this out. Change-Id: I3148ee90e61cdb9d2d6b242ebe4964fb0394416d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121734 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>