[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 9 20:22:06 UTC 2021
include/vcl/outdev.hxx | 8 ++++++++
vcl/source/outdev/map.cxx | 41 +++++++++++++++++++++++++++++++++++++++++
vcl/source/outdev/polyline.cxx | 9 +++++----
3 files changed, 54 insertions(+), 4 deletions(-)
New commits:
commit e5ced8a0e875226152ceae2ad84bac0292e20c4f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 9 20:02:55 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 9 22:21:33 2021 +0200
crashtesting: assert making thumbnail on reexport of tdf127770-1.ods to ods
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 at 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 at 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 at 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 at entry=0x55c3e9e4c700, rOut=..., nPos=86, nPos at 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 at 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 at entry=0x55c3e9e4c700, rBitmapEx=..., eColorConversion=eColorConversion at entry=BmpConversion::N8BitColors, nScaleFlag=nScaleFlag at 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 at redhat.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f5f398a1e0b9..a80b49c2239b 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1787,6 +1787,14 @@ public:
*/
SAL_DLLPRIVATE tools::Polygon ImplLogicToDevicePixel( const tools::Polygon& rLogicPoly ) const;
+ /** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel units.
+
+ @param rLogicSize Const reference to a B2DPolygon in logical units
+
+ @returns B2DPolyPolygon based on physical device pixel coordinates and units.
+ */
+ SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& rLogicPoly ) const;
+
/** Convert a logical polypolygon to a polypolygon in physical device pixel units.
@param rLogicPolyPoly Const reference to a polypolygon in logical units
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 4761062c820c..3410157d2d15 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -268,6 +268,14 @@ static tools::Long ImplLogicToPixel(tools::Long n, tools::Long nDPI, tools::Long
return n;
}
+static double ImplLogicToPixel(double n, tools::Long nDPI, tools::Long nMapNum,
+ tools::Long nMapDenom)
+{
+ assert(nDPI > 0);
+ assert(nMapDenom != 0);
+ return n * nMapNum * nDPI / nMapDenom;
+}
+
static tools::Long ImplPixelToLogic(tools::Long n, tools::Long nDPI, tools::Long nMapNum,
tools::Long nMapDenom)
{
@@ -457,6 +465,39 @@ tools::Polygon OutputDevice::ImplLogicToDevicePixel( const tools::Polygon& rLogi
return aPoly;
}
+basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolygon& rLogicPoly) const
+{
+ if (!mbMap && !mnOutOffX && !mnOutOffY)
+ return rLogicPoly;
+
+ sal_uInt32 nPoints = rLogicPoly.count();
+ basegfx::B2DPolygon aPoly(rLogicPoly);
+
+ if (mbMap)
+ {
+ for (sal_uInt32 i = 0; i < nPoints; ++i)
+ {
+ const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i);
+ basegfx::B2DPoint aPt(ImplLogicToPixel( rPt.getX()+maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX )+mnOutOffX+mnOutOffOrigX,
+ ImplLogicToPixel( rPt.getY()+maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY )+mnOutOffY+mnOutOffOrigY);
+ aPoly.setB2DPoint(i, aPt);
+ }
+ }
+ else
+ {
+ for (sal_uInt32 i = 0; i < nPoints; ++i)
+ {
+ const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i);
+ basegfx::B2DPoint aPt(rPt.getX() + mnOutOffX, rPt.getY() + mnOutOffY);
+ aPoly.setB2DPoint(i, aPt);
+ }
+ }
+
+ return aPoly;
+}
+
tools::PolyPolygon OutputDevice::ImplLogicToDevicePixel( const tools::PolyPolygon& rLogicPolyPoly ) const
{
if ( !mbMap && !mnOutOffX && !mnOutOffY )
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index e3ec909c733b..aeeb90845bd1 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -248,8 +248,6 @@ void OutputDevice::drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLi
if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LineStyle::NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() )
return;
- tools::Polygon aPoly = ImplLogicToDevicePixel( rPoly );
-
// we need a graphics
if ( !mpGraphics && !AcquireGraphics() )
return;
@@ -268,12 +266,15 @@ void OutputDevice::drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLi
const bool bDashUsed(LineStyle::Dash == aInfo.GetStyle());
const bool bLineWidthUsed(aInfo.GetWidth() > 1);
- if(bDashUsed || bLineWidthUsed)
+ if (bDashUsed || bLineWidthUsed)
{
- drawLine ( basegfx::B2DPolyPolygon(aPoly.getB2DPolygon()), aInfo );
+ basegfx::B2DPolygon aPoly = ImplLogicToDevicePixel(rPoly.getB2DPolygon());
+ drawLine(basegfx::B2DPolyPolygon(aPoly), aInfo);
}
else
{
+ tools::Polygon aPoly = ImplLogicToDevicePixel(rPoly);
+
// #100127# the subdivision HAS to be done here since only a pointer
// to an array of points is given to the DrawPolyLine method, there is
// NO way to find out there that it's a curve.
More information about the Libreoffice-commits
mailing list