diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-01-29 18:52:07 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-01-30 14:20:45 +0100 |
commit | 8029179e35fcda5867769d4ca6f7ee32bca3e9bc (patch) | |
tree | fc2a3f52e7513df18bb0590cfb279708ab271204 | |
parent | ac443862c6b9599ae5776767c4a169c37e47477e (diff) |
sw: fix rotation bugs in SwLinePortion::PrePaint()
The sign was flipped for the 90° case, resulting in painting too far
up the page, ever since this was added in
293ed704cf15107049578c2e6e5ed00dcac2d4fb.
In SwControlCharPortion::Paint() rotation wasn't handled at all.
Change-Id: I83a7eef8b2f6126e070d8c48f75378b6cf6d50e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87707
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/source/core/text/porlin.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/text/porrst.cxx | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 0c7ff0252075..b5adccb07fba 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -114,12 +114,12 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf, break; case 900: nPos = sal_uInt16( rInf.Y() ); - nPos -= nLastWidth + nHalfView; + nPos -= nLastWidth - nHalfView; aInf.Y( nPos ); break; case 1800: nPos = sal_uInt16( rInf.X() ); - nPos -= nLastWidth + nHalfView; + nPos -= nLastWidth - nHalfView; aInf.X( nPos ); break; case 2700: diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index e4c56b98669f..686959609cd8 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -522,7 +522,22 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const Point aOldPos = rInf.GetPos(); Point aNewPos( aOldPos ); - aNewPos.setX( aNewPos.X() + ( Width() / 2 ) - mnHalfCharWidth ); + auto const deltaX((Width() / 2) - mnHalfCharWidth); + switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical())) + { + case 0: + aNewPos.AdjustX(deltaX); + break; + case 900: + aNewPos.AdjustY(-deltaX); + break; + case 2700: + aNewPos.AdjustY(deltaX); + break; + default: + assert(false); + break; + } const_cast< SwTextPaintInfo& >( rInf ).SetPos( aNewPos ); rInf.DrawText( aOutString, *this ); |