summaryrefslogtreecommitdiff
path: root/vcl/source/outdev/map.cxx
AgeCommit message (Collapse)AuthorFilesLines
6 daysReturn double from OutputDevice::GetTextArrayMike Kaganski1-0/+29
And introduce GetTextWidth / GetTextHeight variants returning double. It allows to avoid premature rounding. At least in one case - testTdf145111_anchor_in_Fontwork - it allowed to make the test DPI-independent (at least in my testing on Windows, using 125, 150, and 175% UI scaling). Change-Id: I973d2c729ec6bb7114b4f99b9027f1ead7c1d061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166237 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
7 daystdf#160622: Let SalLayout::GetBoundRect return basegfx::B2DRectangleMike Kaganski1-0/+8
This avoids premature rounding in TextLayouterDevice::getTextBoundRect. The box in D2DWriteTextOutRenderer::performRender needs to be expanded to allow room for the line width (which now will be guaranteed on all sides; previously, the rounding could happen to give no room on some side, even prior to commit 8962141a12c966b2d891829925e6203bf8d51852). Fixes some lines partially cut off in smaller text (or zoomed out). Change-Id: I07335136021f894cf045363b4d736bfab06c64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166236 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-27deduplicate some code in ImplCalcMapResolutionNoel Grandin1-38/+25
Change-Id: I792394079c0efbea0ea62f580fbad3bd2a66f93a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154945 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-23vcl: Drop now unneeded DevicePoint typedefKhaled Hosny1-4/+4
It has been always typedef'd to basegfx::B2DPoint since: commit 5e218b5c51f7d9cd10bd9db832879efca41b9c75 Date: Wed Jan 12 21:19:32 2022 +0000 always use B2DPoint for DevicePoint Change-Id: I9f5202d5a71c77dd79f1759923917c26bf68a9af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154632 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-23vcl: Drop recently unused OutputDevice::LogicWidthToDeviceCoordinate()Khaled Hosny1-12/+0
Change-Id: Iff87edfcfa46258236c24bd8f88b552fe9db8891 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154608 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2022-12-01vcl: remove unnecessary includesChris Sherlock1-3/+3
Change-Id: I41cb0b38857ddeef7cb7f82c1b523a9c7fcf2413 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143324 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-11-28tdf#123419 vcl: remove unneeded ImplMakeFraction() in map.cxxChris Sherlock1-30/+18
Change-Id: Iedb33bca9ee1119baafb92a3191960be41ccaffc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143323 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27tdf#123419 optimise ImplMakeFractionNoel Grandin1-31/+1
which is very hot here. Push it down into Fraction, where we can skip the construction of boost::rational intermediate values Change-Id: I7e5f18456a252a159d3a50e9297168e5ba9e1588 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141894 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-03tdf#151262 drop subpixel->logic pos assertsCaolán McNamara1-10/+6
which have served their bootstrapping purpose Change-Id: I04b832fde21e4932ed191d972737bee97510f53a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140903 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-08Turn a macro into a functionMike Kaganski1-11/+12
Change-Id: I7c98ae858f345389b63c4b429367612f7fb3691a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139640 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-26improve ImplSubPixelToLogic sanity checkCaolán McNamara1-1/+1
Change-Id: Iae8620e3ef4f989555e0014459fcd8f152db843b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138872 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-26automatically set TextRenderModeForResolutionIndependentLayout if we scaleCaolán McNamara1-6/+14
Always render glyphs with a mode suitable for rendering of resolution-independent layout positions if we scale the text positions. The idea being to typically continue to use the system defaults for font settings for UI elements, but where we are rendering into application canvases where there's a mapmode set then automatically use a good mode to render that. Change-Id: I0e5857e377da72ae1a2ede1d88d6408819fc9200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138324 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-25retain accuracy when we have subpixels and convert back to Logic unitsCaolán McNamara1-0/+19
Change-Id: If5a8624c1150919cc66f7b7d635edf112b480523 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138738 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-24rename DeviceFontWidth/DeviceFontHeight to DeviceSubPixelCaolán McNamara1-16/+16
Change-Id: I5378169e2c1d4d15fa160c3c2d2a130556dc80b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138747 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-24move & rename height relevant function near & similar to its width equivalentCaolán McNamara1-8/+9
Change-Id: Icab3c11d6968efbbdb0f9f7f1dfeba2709e22a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138746 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-30Resolves: tdf#147013 transform the control point positions tooCaolán McNamara1-0/+55
Change-Id: Ia73317a79de66778d4b2d0face07ee4c41e328d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129157 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-16tdf#146453 retain precise vertical base pos with ResolutionIndependentLayoutCaolán McNamara1-7/+10
Change-Id: Ied157d8d4bc9b57cfa17716453189ddf48cba641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128485 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-16tdf#146439 retain precise base start pos when using ResolutionIndependentLayoutCaolán McNamara1-1/+12
Change-Id: I16a585abf4805d87a2eeb4e3e9d9bd9f2697b838 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128472 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-13keep scaled ResolutionIndependentLayout glyph positions as floating pointCaolán McNamara1-0/+8
When rendering in ResolutionIndependentLayout mode keep the scaled glyph positions as floating point all the way down to the renderer Change-Id: I02415f18c26737a886751972f472b499a25c776b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128379 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-11make VCL_FLOAT_DEVICE_PIXEL compileCaolán McNamara1-2/+1
Change-Id: I0673b77a24085a8f06471d67c4cfdec43047c226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128290 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-08vcl: split out outdev.h into seperate headersChris Sherlock1-1/+1
outdev.h is a hodge-podge of functions - font substitution and an internal state struct for OutputDevice. I have split these into: - font/fontsubstitution: FontSubstitution, GlyphFallbackFontSubstitution.hxx and PreMatchFontSubstitution.hxx (all three define pure virtual base classes for later reuse) - font/DirectFontSubstitution.hxx: incorporates FontSubstEntry and DirectFontSubstitution - ImplOutDevData.hxx contains it's own class Each fo the classes has been moved to the vcl::font namespace. As outdev.h is now no longer, this has meant that I have had to regenerate vcl/inc/pch/precompiled_vcl.hxx Change-Id: Iaa92fa21271faff46f2a8a0f6488e01434c142db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121997 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-25vcl: Add sal/config.h in preparation for patchChris Sherlock1-0/+2
Done in preparation of split of outdev.h into seperate headers Change-Id: I9183f9e10a3fd47557239b8cc9290ce8e86e614a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122255 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 McNamara1-0/+41
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-04-24Fix typosAndrea Gelmini1-1/+1
Change-Id: I0a8279429c9e0d884a5e8fbb8f22617832385a53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114574 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2021-04-22tdf#141761 Avoid vanishing FormControlsArmin Le Grand (Allotropia)1-74/+139
For details see task documentaion, but BG is that a Rectangle gets not transformed in OutputDevice::LogicToPixel and corresponding methods of OutputDevice due to the given Rectangle.IsEmpty() == true. This ignores that the Rectangle has a valid position and that we have cases where a Rectangle is used to hold a Position without having a Size != 0 in X and Y. Thus I added transforming the Position in these methods in all cases - a Rectangle always has a valid position - and take care of Sizes that exist. This *may* need to be done different due to old hiccups of Rectangle itself, see explanation at OutputDevice::ImplLogicToDevicePixel Had to do it different now, see comment in map.cxx for expalantions. Also needed to adapt the ancient optical geometric paint position correctionsfor Buttons - these can get zero or negative due to using Zoom and MapMode settings. A Width shoul not get zero or negative. Change-Id: Ide085fbe74f9c0387de3c1bf6320b7e873238029 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114304 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2021-02-22Fix computation of aF fraction in OutputDevice::SetRelativeMapModeStephan Bergmann1-2/+2
...where cfff893b9c82843a90aac4ecdb3a3936721b74a0 "Move unit conversion code to o3tl, and unify on that in more places" had apparently switched the numerator and denominator arguments passed into the Fraction constructor. (And give the two values returned by o3tl::getConversionMulDiv less misleading names.) This had caused e.g. UITest_conditional_format UITEST_TEST_NAME=tdf100793.tdf100793.test_tdf100793 to fail in a (--without-system-cairo) UBSan build with > cairo-slope-private.h:50:22: runtime error: signed integer overflow: -2126627072 - 135139840 cannot be represented in type 'int' > #0 in _cairo_slope_init at workdir/UnpackedTarball/cairo/src/./cairo-slope-private.h:50:22 > #1 in _cairo_path_fixed_line_to at workdir/UnpackedTarball/cairo/src/cairo-path-fixed.c:517:6 > #2 in _cairo_default_context_line_to at workdir/UnpackedTarball/cairo/src/cairo-default-context.c:715:12 > #3 in cairo_line_to at workdir/UnpackedTarball/cairo/src/cairo.c:1743:14 > #4 in AddPolygonToPath(_cairo*, basegfx::B2DPolygon const&, basegfx::B2DHomMatrix const&, bool, bool) at vcl/headless/svpgdi.cxx:1291:13 > #5 in (anonymous namespace)::add_polygon_path(_cairo*, basegfx::B2DPolyPolygon const&, basegfx::B2DHomMatrix const&, bool) at vcl/headless/svpgdi.cxx:1821:33 > #6 in SvpSalGraphics::drawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double) at vcl/headless/svpgdi.cxx:1879:9 > #7 in SvpSalGraphics::drawRect(long, long, long, long) at vcl/headless/svpgdi.cxx:1059:9 > #8 in SalGraphics::DrawRect(long, long, long, long, OutputDevice const&) at vcl/source/gdi/salgdilayout.cxx:373:5 > #9 in OutputDevice::DrawRect(tools::Rectangle const&) at vcl/source/outdev/rect.cxx:83:17 > #10 in (anonymous namespace)::drawCells(OutputDevice&, std::optional<Color> const&, SvxBrushItem const*, std::optional<Color>&, SvxBrushItem const*&, tools::Rectangle&, long, long, long, long, ScDataBarInfo const*, ScDataBarInfo const*&, ScIconSetInfo const*, ScIconSetInfo const*&, std::__debug::map<rtl::OUString, BitmapEx, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, BitmapEx> > >&) at sc/source/ui/view/output.cxx:947:32 > #11 in ScOutputData::DrawBackground(OutputDevice&) at sc/source/ui/view/output.cxx:1116:21 > #12 in ScPrintFunc::DrawToDev(ScDocument&, OutputDevice*, double, tools::Rectangle const&, ScViewData*, bool) at sc/source/ui/view/printfun.cxx:594:17 > #13 in ScDocShell::Draw(OutputDevice*, JobSetup const&, unsigned short) at sc/source/ui/docshell/docsh4.cxx:2146:9 > #14 in SfxObjectShell::DoDraw_Impl(OutputDevice*, Point const&, Fraction const&, Fraction const&, JobSetup const&, unsigned short) at sfx2/source/doc/objembed.cxx:194:5 > #15 in SfxObjectShell::DoDraw(OutputDevice*, Point const&, Size const&, JobSetup const&, unsigned short) at sfx2/source/doc/objembed.cxx:141:9 > #16 in SfxObjectShell::CreatePreview_Impl(bool, VirtualDevice*, GDIMetaFile*) const at sfx2/source/doc/objcont.cxx:199:40 > #17 in SfxObjectShell::GetPreviewBitmap() const at sfx2/source/doc/objcont.cxx:110:9 > #18 in SfxPickListImpl::AddDocumentToPickList(SfxObjectShell const*) at sfx2/source/appl/sfxpicklist.cxx:120:46 > #19 in SfxPickListImpl::Notify(SfxBroadcaster&, SfxHint const&) at sfx2/source/appl/sfxpicklist.cxx:208:13 > #20 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:39:24 > #21 in (anonymous namespace)::SfxEventAsyncer_Impl::IdleHdl(Timer*) at sfx2/source/appl/appcfg.cxx:105:19 > #22 in (anonymous namespace)::SfxEventAsyncer_Impl::LinkStubIdleHdl(void*, Timer*) at sfx2/source/appl/appcfg.cxx:100:1 > #23 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45 > #24 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21 > #25 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:476:20 > #26 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:266:5 > #27 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13 > #28 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:210:53 > #29 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:463:21 > #30 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:463:48 > #31 in Application::Yield() at vcl/source/app/svapp.cxx:530:5 > #32 in Application::Execute() at vcl/source/app/svapp.cxx:442:9 > #33 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1586:13 > #34 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35 > #35 in SVMain() at vcl/source/app/svmain.cxx:228:12 > #36 in soffice_main at desktop/source/app/sofficemain.cxx:98:12 > #37 in sal_main at desktop/source/app/main.c:49:15 > #38 in main at desktop/source/app/main.c:47:1 because aF was computed as 2540/1 instead of 1/2540 now. Change-Id: I092e6afe8cf2ea3145befccf075252b8e09f0967 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111347 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-02-14Move unit conversion code to o3tl, and unify on that in more placesMike Kaganski1-103/+63
This also allows to easily add more units, both of length and for other unit categories. The conversion for "Line" unit (312 twip) is questionable. Corresponding entries in aImplFactor in vcl/source/control/field.cxx were inconsistent (45/11 in; 10/13 pc; 156/10 pt). They were added without explanation in commit c85db626029fd8a5e0dfcb312937279df32339a0. I haven't found a spec of the unit (https://en.wikipedia.org/wiki/Line_(unit) is not specific). I used the definition based on "by pt", "by mm/100", "by char" (they all were consistent); "by pc" seems inverted; "by twip" was half as much. This accepted conversion makes unit test for tdf#79236 pass. Change-Id: Iae5a21d915fa8e934a1f47f8ba9f6df03b79a9fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110839 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-02cid#1470369 Uninitialized scalar variableCaolán McNamara1-15/+3
and cid#1470372 Uninitialized scalar variable cid#1470364 Uninitialized scalar variable cid#1470363 Uninitialized scalar variable cid#1470359 Uninitialized scalar variable cid#1470357 Uninitialized scalar variable cid#1470355 Uninitialized scalar variable cid#1470354 Uninitialized scalar variable cid#1470353 Uninitialized scalar variable Change-Id: I4a28f0f375f9108f4c43da7074f85d1fdbb3ebff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107070 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-11-19Drop threshold for BigInt arithmetics from ImplLogicToPixel/ImplPixelToLogicMike Kaganski1-286/+121
Initially (since commit 8ab086b6cc054501bfbf7ef6fa509c393691e860) the code in vcl/source/outdev/map.cxx used BigInt arithmetics for overflowing cases. Then in commit 99a299383f2f16e5e8eefbb28e88a6a8f90ab95b, the code started to use sal_Int64, and ignored the threshold. Immideately in next day's commit 7bbb9d113a732851831dfadf8dee6b980dc0ab3b, the fallback to BigInt was restored - "when 64bit arithmetic does not suffice for mapping". Commit d563ac66ae12353c2c25d154fc9f493df67b3b8b made two modes - one using sal_Int64, and one using BigInt - separate (dependent on USE_64BIT_INTS), and introduced shortcut depending on threshold also into USE_64BIT_INTS code, dependent on SAL_TYPES_SIZEOFLONG ("#i55136# prefer native int math over int64"). BigInt code was dropped in commit b5100f8a1c76a921406ed3d3a54ba2479b011977. So now, after the functions take tools::Long, and it is 64-bit on _WIN64, it's incorrect to depend on SAL_TYPES_SIZEOFLONG for the shortcut. And making it dependent on sizeof(tools::Long) seems unnecessary, because now it's only active to 32-bit platforms with decreasing relevance, and the profit there is unclear, having to calculate threshold for each operation on all platforms. So this drops the threshold unconditionally, unifying the code on all platforms. If BigInt mode would be necessary, this should be reintroduced on all platforms, but for now we rely on 64-bit arithmetics, as we did before this patch. And while at it, replaced outdated uses of LONG_MAX/LONG_MIN with correct numeric limits for tools::Long, to avoid more BigInt operations. Change-Id: I8d6039c851d76712b391e754d3f78a97a8463f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106121 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-13Revert "remove BigInt::operator tools::Long()"Noel Grandin1-6/+6
This reverts commit 1397a1c8e4995b0dd336478e564880fe8ad91d1d. Reason for revert: Some discussion required Change-Id: Id39ee8260790e0722c5bf8338b0b76ca34da83d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105539 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-12remove BigInt::operator tools::Long()Noel1-6/+6
which was introduced in commit adf0738d2dbfa742d0e9ef130954fb4638a8e90d Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Jan 3 14:25:15 2018 +0200 long->sal_Int32 in BigInt presumably to make the conversion easier. Instead just fix the call-sites to select a better conversion, BigInt only returns 32-bits of precision anyway. Change-Id: I2e4354bcfded01763fe3312a715ef37800297876 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105602 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11convert more long -> tools::LongNoel1-2/+2
found by grepping and changed by hand. Change-Id: I3c720859dba430fde3abc76c6c5cb58269efaf4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105512 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11make tools::Long 64-bit on Windows platformNoel Grandin1-2/+2
This is only for the 64-bit windows platform. I don't see the point in messing with the 32-bit platforms, they are (a) become more and more rare (b) unlikely to even have enough available process memory to load extremely large calc spreadsheets The primary problem we are addressing here is bringing Windows-64bit up to same capability as Linux-64bit when it comes to handling very large spreadsheets, which is caused by things like tools::Rectangle using "long", which means that all the work done to make Libreoffice on 64-bit Linux capable of loading large spreadsheets is useless on Windows, where long is 32-bit. The operator<< for tools::Rectangle needs to be inside the tools namespace because of an interaction with the cppunit printing template stuff that I don't understand. SalPoint changed to use sal_Int32, since it needs to be the same definition as the Windows POINT structure. Change-Id: Iab6f1af88847b6c8d46995e8ceda3f82b6722ff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-28convert some more long -> tools::LongNoel1-1/+1
grepping for stuff in template params this time Change-Id: Ia37bfd85480b3a72c3c465489581d56ad8dde851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-19use tools::Long in vclNoel1-51/+51
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-08-23set point values via ctorCaolán McNamara1-5/+4
Change-Id: Icb17ea1b82128669d4f35492fba70c7d89f9fdca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101191 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-23use a reference instead of a pointerCaolán McNamara1-3/+3
Change-Id: I15b23f8b8f469b9bfcadb0bd72b7f01f6b5c8fc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101190 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-02Upcoming improved loplugin:staticanonymous -> redundantstatic: vclStephan Bergmann1-3/+3
Change-Id: I7559ab5c98a22e315549b5dfc651e937697cac22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97742 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-01tdf#74702 vcl: extract SetMetafileMapMode()Chris Sherlock1-0/+8
Change-Id: Icdd9d612b998d260c4cf0e30fb38e72b5ebd3194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94723 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-01-19tdf#74702: clean up of OutputDevice::SetMapModeAdrien Ollier1-10/+4
All changes are formatted using clang-format utility. Change-Id: Icfa7ae22bc06e57c7f7cb512813966dcefd4fc40 Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83601 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2019-12-18vcl: sfx2: LOK: Support per-view popup windowsAshod Nakashian1-2/+2
While we do support multiple views, there is only one state for popup/floating windows, that also includes the dialogs open and related windows/data. This adds support to allow each view to have its own popups and state, thus allowing multiple users to interact with the dialogs independently of one another. (cherry picked from commit b50c341a53911f1d725947a4d8d3d2f782c94079) Change-Id: I3786a561ca6ca113ad12425bdb491e5a30bd1a28 Reviewed-on: https://gerrit.libreoffice.org/82440 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/85221 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-07Drop some useless warnings that we get hundreds ofTor Lillqvist1-4/+0
Change-Id: Ie83b4ad7a7ab1c26ff081f70ad98eb39a04f1015 (cherry picked from commit 7dd803da92d9b2ff36ded57ea22fbb41ef1db28f) Reviewed-on: https://gerrit.libreoffice.org/79253 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit dedf3da4d33a51f63006b125991e1d64d70df381)
2019-06-05make OutputDevice::LogicToLogic respect empty Rectangle in more casesNoel Grandin1-8/+12
follow the logic from the block at the top of the function Change-Id: I3756eac9eb4fddb239a433927c52a505c7ab9b36 Reviewed-on: https://gerrit.libreoffice.org/73547 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-13handle empty tools::Rectangle in vclNoel Grandin1-4/+8
Change-Id: I64b5c3c5a19408febe7753db6ea403b91f7f5c83 Reviewed-on: https://gerrit.libreoffice.org/72188 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-12drop warning we're going to do nothing aboutCaolán McNamara1-4/+0
Change-Id: I44cc4b3c4f1af21e0d7a2a0914a5e84a6f4453d7 Reviewed-on: https://gerrit.libreoffice.org/70605 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-01-15vcl: protect more outdev functions for disposed stateMiklos Vajna1-2/+2
This is similar to commit c612c3b0aed9ad7f7f42b4313f821b71995ead15 (protect more printer code-paths., 2015-03-20), but handles more OutputDevice member functions. The user-level problem was that in case a macro creates a dialog with an embedded Chart document and the user clicks on e.g. the chart title (so an sdr::overlay::OverlayManager is created), then it can happen during closing the dialog that the overlay manager calls these functions after the output device is disposed. Change-Id: I8021fb795704f19e52d70505804d68725c636ce0 Reviewed-on: https://gerrit.libreoffice.org/66403 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-01-07tdf#42949 Fix IWYU warnings in include/vcl/[v-x]*Gabor Kelemen1-0/+2
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I98f49765c6b74808dcbd692e0f375dd2848fcfd4 Reviewed-on: https://gerrit.libreoffice.org/65614 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-19tdf#42949 Fix IWYU warnings in include/vcl/[ab]*Gabor Kelemen1-0/+1
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>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann1-1/+1
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17New loplugin:externalStephan Bergmann1-1/+1
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>