diff options
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/map.cxx | 17 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 11 |
3 files changed, 18 insertions, 14 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 4b9d1e7e626a..7e1a0fad7dcd 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1685,6 +1685,7 @@ public: @returns Physical point on the device. */ SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const; + SAL_DLLPRIVATE DevicePoint ImplLogicToDeviceFontCoordinate(const Point& rLogicPt) const; /** Convert a logical width to a width in units of device pixels. @@ -1697,9 +1698,9 @@ public: @returns Width in units of device pixels. */ SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel( tools::Long nWidth ) const; + SAL_DLLPRIVATE double ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const; SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long nWidth ) const; - SAL_DLLPRIVATE double LogicWidthToDeviceFontCoordinate( tools::Long nWidth ) const; /** Convert a logical X coordinate to a device pixel's X coordinate. @@ -1713,7 +1714,6 @@ public: @returns Device's X pixel coordinate */ SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX ) const; - SAL_DLLPRIVATE double LogicXToDeviceFontCoordinate( tools::Long nWidth ) const; /** Convert a logical Y coordinate to a device pixel's Y coordinate. diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 5144f0f89f9f..918d8a5a77df 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -1830,7 +1830,7 @@ DeviceCoordinate OutputDevice::LogicWidthToDeviceCoordinate( tools::Long nWidth #endif } -double OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const +double OutputDevice::ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const { if (!mbMap) return nWidth; @@ -1839,14 +1839,17 @@ double OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX); } -double OutputDevice::LogicXToDeviceFontCoordinate(tools::Long nX) const +DevicePoint OutputDevice::ImplLogicToDeviceFontCoordinate(const Point& rPoint) const { if (!mbMap) - return nX + mnOutOffX; - - return ImplLogicToPixel(static_cast<double>(nX + maMapRes.mnMapOfsX), mnDPIX, - maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX) - + mnOutOffX + mnOutOffOrigX; + return DevicePoint(rPoint.X() + mnOutOffX, rPoint.Y() + mnOutOffY); + + return DevicePoint(ImplLogicToPixel(static_cast<double>(rPoint.X() + maMapRes.mnMapOfsX), mnDPIX, + maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX) + + mnOutOffX + mnOutOffOrigX, + ImplLogicToPixel(static_cast<double>(rPoint.Y() + maMapRes.mnMapOfsY), mnDPIY, + maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY) + + mnOutOffY + mnOutOffOrigY); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 49ca790b8aec..3d773e56d488 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1359,7 +1359,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, xNaturalDXPixelArray.reset(new double[nLen]); for (int i = 0; i < nLen; ++i) - xNaturalDXPixelArray[i] = LogicWidthToDeviceFontCoordinate(pDXArray[i]); + xNaturalDXPixelArray[i] = ImplLogicWidthToDeviceFontWidth(pDXArray[i]); aLayoutArgs.SetAltNaturalDXArray(xNaturalDXPixelArray.get()); nEndGlyphCoord = std::lround(xNaturalDXPixelArray[nLen - 1]); @@ -1426,12 +1426,13 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, // position, justify, etc. the layout pSalLayout->AdjustLayout( aLayoutArgs ); - Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos); if (bTextRenderModeForResolutionIndependentLayout) - pSalLayout->DrawBase().setX(LogicXToDeviceFontCoordinate(rLogicalPos.X())); + pSalLayout->DrawBase() = ImplLogicToDeviceFontCoordinate(rLogicalPos); else - pSalLayout->DrawBase().setX(aDevicePos.X()); - pSalLayout->DrawBase().setY(aDevicePos.Y()); + { + Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos); + pSalLayout->DrawBase() = DevicePoint(aDevicePos.X(), aDevicePos.Y()); + } // adjust to right alignment if necessary if( aLayoutArgs.mnFlags & SalLayoutFlags::RightAlign ) |