summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-10-03 11:14:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-10-03 21:31:44 +0200
commite5d59895ef3897141e5df304a8f98776aa70f021 (patch)
tree0cee35b8d57eace4b23f1ed454665b2277add5bf /vcl/source
parent5a1c668747f3495ddc7567ae95f2145663565647 (diff)
tdf#151262 drop subpixel->logic pos asserts
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>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx43
-rw-r--r--vcl/source/gdi/sallayout.cxx10
-rw-r--r--vcl/source/outdev/map.cxx16
3 files changed, 26 insertions, 43 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2082056940f9..cf5ee9dca0f7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6226,7 +6226,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const OUString& rText, bool
rLayout.DrawOffset() += Point( nOff, nOff );
updateGraphicsState();
- drawLayout( rLayout, rText, bTextLines, false );
+ drawLayout( rLayout, rText, bTextLines );
rLayout.DrawOffset() -= Point( nOff, nOff );
setTextLineColor( aTextLineColor );
@@ -6234,7 +6234,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const OUString& rText, bool
aSetFont.SetColor( aTextColor );
setFont( aSetFont );
updateGraphicsState();
- drawLayout( rLayout, rText, bTextLines, true );
+ drawLayout( rLayout, rText, bTextLines );
// clean up the mess
pop();
@@ -6262,7 +6262,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const OUString& rText, bool
if( rFont.IsOutline() )
nOff++;
rLayout.DrawBase() += DevicePoint(nOff, nOff);
- drawLayout( rLayout, rText, bTextLines, false );
+ drawLayout( rLayout, rText, bTextLines );
rLayout.DrawBase() -= DevicePoint(nOff, nOff);
setFont( aSaveFont );
@@ -6279,11 +6279,10 @@ void PDFWriterImpl::drawVerticalGlyphs(
double fAngle,
double fXScale,
double fSkew,
- sal_Int32 nFontHeight,
- bool bCheck )
+ sal_Int32 nFontHeight)
{
double nXOffset = 0;
- Point aCurPos(SubPixelToLogic(rGlyphs[0].m_aPos, bCheck && fAngle == 0.0));
+ Point aCurPos(SubPixelToLogic(rGlyphs[0].m_aPos));
aCurPos += rAlignOffset;
for( size_t i = 0; i < rGlyphs.size(); i++ )
{
@@ -6303,7 +6302,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
fSkewA = -fSkewB;
fSkewB = 0.0;
}
- aDeltaPos += SubPixelToLogic(DevicePoint(nXOffset / fXScale, 0), false) - SubPixelToLogic(DevicePoint(), bCheck);
+ aDeltaPos += SubPixelToLogic(DevicePoint(nXOffset / fXScale, 0)) - SubPixelToLogic(DevicePoint());
if( i < rGlyphs.size()-1 )
// #i120627# the text on the Y axis is reversed when export ppt file to PDF format
{
@@ -6347,9 +6346,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
double fXScale,
double fSkew,
sal_Int32 nFontHeight,
- sal_Int32 nPixelFontHeight,
- bool bCheck
- )
+ sal_Int32 nPixelFontHeight)
{
// horizontal (= normal) case
@@ -6374,7 +6371,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
for( size_t nRun = 0; nRun < aRunEnds.size(); nRun++ )
{
// setup text matrix back transformed to current coordinate system
- Point aCurPos(SubPixelToLogic(rGlyphs[nBeginRun].m_aPos, bCheck && fAngle == 0.0));
+ Point aCurPos(SubPixelToLogic(rGlyphs[nBeginRun].m_aPos));
aCurPos += rAlignOffset;
// the first run can be set with "Td" operator
// subsequent use of that operator would move
@@ -6445,7 +6442,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
}
}
-void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines, bool bCheckSubPixelToLogic )
+void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines )
{
// relief takes precedence over shadow (see outdev3.cxx)
if( m_aCurrentPDFState.m_aFont.GetRelief() != FontRelief::NONE )
@@ -6677,7 +6674,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
// ascent / descent to match the on-screen rendering.
// This is the top left of the text without ascent / descent.
DevicePoint aDrawPosition(rLayout.GetDrawPosition());
- tools::Rectangle aRectangle(SubPixelToLogic(aDrawPosition, bCheckSubPixelToLogic),
+ tools::Rectangle aRectangle(SubPixelToLogic(aDrawPosition),
Size(ImplDevicePixelToLogicWidth(rLayout.GetTextWidth()), 0));
aRectangle.AdjustTop(-aRefDevFontMetric.GetAscent());
// This includes ascent / descent.
@@ -6688,7 +6685,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
{
// Adapt rectangle for rotated text.
tools::Polygon aPolygon(aRectangle);
- aPolygon.Rotate(SubPixelToLogic(aDrawPosition, bCheckSubPixelToLogic), pFontInstance->mnOrientation);
+ aPolygon.Rotate(SubPixelToLogic(aDrawPosition), pFontInstance->mnOrientation);
drawPolygon(aPolygon);
}
else
@@ -6744,9 +6741,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
if (bVertical)
- drawVerticalGlyphs(aRun, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight, !rLayout.IsMultiSalLayout());
+ drawVerticalGlyphs(aRun, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight);
else
- drawHorizontalGlyphs(aRun, aLine, aAlignOffset, nStart == 0, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight, !rLayout.IsMultiSalLayout());
+ drawHorizontalGlyphs(aRun, aLine, aAlignOffset, nStart == 0, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight);
if (nCharPos >= 0 && nCharCount)
aLine.append( "EMC\n" );
@@ -6791,7 +6788,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
else if( nWidth > 0 )
{
- drawTextLine( SubPixelToLogic(aStartPt, bCheckSubPixelToLogic),
+ drawTextLine( SubPixelToLogic(aStartPt),
ImplDevicePixelToLogicWidth( nWidth ),
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
nWidth = 0;
@@ -6800,7 +6797,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
if( nWidth > 0 )
{
- drawTextLine( SubPixelToLogic(aStartPt, bCheckSubPixelToLogic),
+ drawTextLine( SubPixelToLogic(aStartPt),
ImplDevicePixelToLogicWidth( nWidth ),
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
@@ -6809,7 +6806,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
{
DevicePoint aStartPt = rLayout.GetDrawPosition();
int nWidth = rLayout.GetTextWidth() / rLayout.GetUnitsPerPixel();
- drawTextLine( SubPixelToLogic(aStartPt, bCheckSubPixelToLogic),
+ drawTextLine( SubPixelToLogic(aStartPt),
ImplDevicePixelToLogicWidth( nWidth ),
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
@@ -6875,7 +6872,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
DevicePoint aMarkDevPos(aPos);
aMarkDevPos += aAdjOffset;
- Point aMarkPos = SubPixelToLogic(aMarkDevPos, bCheckSubPixelToLogic);
+ Point aMarkPos = SubPixelToLogic(aMarkDevPos);
drawEmphasisMark( aMarkPos.X(), aMarkPos.Y(),
aEmphasisMark.GetShape(), aEmphasisMark.IsShapePolyLine(),
aEmphasisMark.GetRect1(), aEmphasisMark.GetRect2() );
@@ -6940,7 +6937,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int3
0, {}, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs );
if( pLayout )
{
- drawLayout( *pLayout, rText, bTextLines, true );
+ drawLayout( *pLayout, rText, bTextLines );
}
}
@@ -6958,7 +6955,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, o3t
SalLayoutFlags::NONE, nullptr, layoutGlyphs );
if( pLayout )
{
- drawLayout( *pLayout, rText, true, true );
+ drawLayout( *pLayout, rText, true );
}
}
@@ -6976,7 +6973,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const
{}, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs );
if( pLayout )
{
- drawLayout( *pLayout, rText, true, true );
+ drawLayout( *pLayout, rText, true );
}
}
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ea33fd170e58..b960d510ac24 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -265,11 +265,6 @@ SalLayoutGlyphs SalLayout::GetGlyphs() const
return SalLayoutGlyphs(); // invalid
}
-bool SalLayout::IsMultiSalLayout() const
-{
- return false;
-}
-
DeviceCoordinate GenericSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths, const OUString& rStr ) const
{
if (pCharWidths)
@@ -1217,9 +1212,4 @@ SalLayoutGlyphs MultiSalLayout::GetGlyphs() const
return glyphs;
}
-bool MultiSalLayout::IsMultiSalLayout() const
-{
- return true;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index a48e5a3f3670..2c3801bf9e84 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -275,20 +275,16 @@ static double ImplLogicToSubPixel(tools::Long n, tools::Long nDPI, tools::Long n
{
assert(nDPI > 0);
assert(nMapDenom != 0);
- double nRet = static_cast<double>(n) * nMapNum * nDPI / nMapDenom;
- return nRet;
+ return static_cast<double>(n) * nMapNum * nDPI / nMapDenom;
}
-static tools::Long ImplSubPixelToLogic(bool bCheck, double n, tools::Long nDPI, tools::Long nMapNum,
+static tools::Long ImplSubPixelToLogic(double n, tools::Long nDPI, tools::Long nMapNum,
tools::Long nMapDenom)
{
assert(nDPI > 0);
assert(nMapNum != 0);
- double nRes = n * nMapDenom / nMapNum / nDPI;
- tools::Long nRet(std::round(nRes));
- assert(!bCheck || rtl_math_approxValue(n) == rtl_math_approxValue(static_cast<double>(nRet) * nMapNum * nDPI / nMapDenom)); (void)bCheck;
- return nRet;
+ return std::round(n * nMapDenom / nMapNum / nDPI);
}
static tools::Long ImplPixelToLogic(tools::Long n, tools::Long nDPI, tools::Long nMapNum,
@@ -1178,7 +1174,7 @@ Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const
maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY ) - maMapRes.mnMapOfsY - mnOutOffLogicY );
}
-Point OutputDevice::SubPixelToLogic(const DevicePoint& rDevicePt, bool bCheck) const
+Point OutputDevice::SubPixelToLogic(const DevicePoint& rDevicePt) const
{
if (!mbMap)
{
@@ -1186,9 +1182,9 @@ Point OutputDevice::SubPixelToLogic(const DevicePoint& rDevicePt, bool bCheck) c
return Point(rDevicePt.getX(), rDevicePt.getY());
}
- return Point(ImplSubPixelToLogic(bCheck, rDevicePt.getX(), mnDPIX,
+ return Point(ImplSubPixelToLogic(rDevicePt.getX(), mnDPIX,
maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX) - maMapRes.mnMapOfsX - mnOutOffLogicX,
- ImplSubPixelToLogic(bCheck, rDevicePt.getY(), mnDPIY,
+ ImplSubPixelToLogic(rDevicePt.getY(), mnDPIY,
maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY) - maMapRes.mnMapOfsY - mnOutOffLogicY);
}