include/vcl/outdev.hxx     |   18 +++---------------
 vcl/source/outdev/font.cxx |    2 +-
 vcl/source/outdev/map.cxx  |   43 ++++++++++++++++++++++---------------------
 vcl/source/outdev/text.cxx |    4 ++--
 4 files changed, 28 insertions(+), 39 deletions(-)

New commits:
commit 573d6a12a450949246516c8d69e173c8c7680fc2
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Aug 23 21:39:44 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Aug 24 11:25:29 2022 +0200

    rename DeviceFontWidth/DeviceFontHeight to DeviceSubPixel
    
    Change-Id: I5378169e2c1d4d15fa160c3c2d2a130556dc80b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138747
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 82b3180d212f..3f00d9dcde12 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1692,7 +1692,7 @@ public:
      @returns Physical point on the device.
      */
     SAL_DLLPRIVATE Point        ImplLogicToDevicePixel( const Point& rLogicPt 
) const;
-    SAL_DLLPRIVATE DevicePoint  ImplLogicToDeviceFontCoordinate(const Point& 
rLogicPt) const;
+    SAL_DLLPRIVATE DevicePoint  ImplLogicToDeviceSubPixel(const Point& 
rLogicPt) const;
 
     /** Convert a logical width to a width in units of device pixels.
 
@@ -1705,7 +1705,7 @@ 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 double              
ImplLogicWidthToDeviceSubPixel(tools::Long nWidth) const;
 
     /** Convert a logical height to a height in units of device pixels.
 
@@ -1718,7 +1718,7 @@ public:
      @returns Height in units of device pixels.
      */
     SAL_DLLPRIVATE tools::Long         ImplLogicHeightToDevicePixel( 
tools::Long nHeight ) const;
-    SAL_DLLPRIVATE double              
ImplLogicHeightToDeviceFontHeight(tools::Long nHeight) const;
+    SAL_DLLPRIVATE double              
ImplLogicHeightToDeviceSubPixel(tools::Long nHeight) const;
 
     /** Convert device pixels to a width in logical units.
 
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index e8887169497e..e24d6ac014db 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -864,7 +864,7 @@ bool OutputDevice::ImplNewFont() const
 
     // convert to pixel height
     // TODO: replace integer based aSize completely with subpixel accurate type
-    float fExactHeight = 
ImplLogicHeightToDeviceFontHeight(maFont.GetFontHeight());
+    float fExactHeight = 
ImplLogicHeightToDeviceSubPixel(maFont.GetFontHeight());
     Size aSize = ImplLogicToDevicePixel( maFont.GetFontSize() );
     if ( !aSize.Height() )
     {
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index b6269916ad33..c184b255af2b 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -270,12 +270,12 @@ 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,
+static double ImplLogicToSubPixel(tools::Long n, tools::Long nDPI, tools::Long 
nMapNum,
                                          tools::Long nMapDenom)
 {
     assert(nDPI > 0);
     assert(nMapDenom != 0);
-    return n * nMapNum * nDPI / nMapDenom;
+    return static_cast<double>(n) * nMapNum * nDPI / nMapDenom;
 }
 
 static tools::Long ImplPixelToLogic(tools::Long n, tools::Long nDPI, 
tools::Long nMapNum,
@@ -1871,41 +1871,41 @@ DeviceCoordinate 
OutputDevice::LogicWidthToDeviceCoordinate( tools::Long nWidth
         return static_cast<DeviceCoordinate>(nWidth);
 
 #if VCL_FLOAT_DEVICE_PIXEL
-    return ImplLogicToPixel(static_cast<double>(nWidth), mnDPIX, 
maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX);
+    return ImplLogicToSubPixel(nWidth, mnDPIX, maMapRes.mnMapScNumX, 
maMapRes.mnMapScDenomX);
 #else
     return ImplLogicToPixel(nWidth, mnDPIX, maMapRes.mnMapScNumX, 
maMapRes.mnMapScDenomX);
 #endif
 }
 
-double OutputDevice::ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const
+double OutputDevice::ImplLogicWidthToDeviceSubPixel(tools::Long nWidth) const
 {
     if (!mbMap)
         return nWidth;
 
-    return ImplLogicToPixel(static_cast<double>(nWidth), mnDPIX,
-                            maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX);
+    return ImplLogicToSubPixel(nWidth, mnDPIX,
+                               maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX);
 }
 
-double OutputDevice::ImplLogicHeightToDeviceFontHeight(tools::Long nHeight) 
const
+double OutputDevice::ImplLogicHeightToDeviceSubPixel(tools::Long nHeight) const
 {
     if (!mbMap)
         return nHeight;
 
-    return ImplLogicToPixel(static_cast<double>(nHeight), mnDPIY,
-                            maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY);
+    return ImplLogicToSubPixel(nHeight, mnDPIY,
+                               maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY);
 }
 
-DevicePoint OutputDevice::ImplLogicToDeviceFontCoordinate(const Point& rPoint) 
const
+DevicePoint OutputDevice::ImplLogicToDeviceSubPixel(const Point& rPoint) const
 {
     if (!mbMap)
         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);
+    return DevicePoint(ImplLogicToSubPixel(rPoint.X() + maMapRes.mnMapOfsX, 
mnDPIX,
+                                           maMapRes.mnMapScNumX, 
maMapRes.mnMapScDenomX)
+                                           + mnOutOffX + mnOutOffOrigX,
+                       ImplLogicToSubPixel(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 823362c6c071..55ddbde7e1a1 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1391,7 +1391,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const 
OUString& rOrigStr,
                 // without rounding, keeping accuracy for lower levels
                 bTextRenderModeForResolutionIndependentLayout = true;
                 for (int i = 0; i < nLen; ++i)
-                    xNaturalDXPixelArray[i] = 
ImplLogicWidthToDeviceFontWidth(pDXArray[i]);
+                    xNaturalDXPixelArray[i] = 
ImplLogicWidthToDeviceSubPixel(pDXArray[i]);
 
             }
             else
@@ -1444,7 +1444,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const 
OUString& rOrigStr,
     pSalLayout->AdjustLayout( aLayoutArgs );
 
     if (bTextRenderModeForResolutionIndependentLayout)
-        pSalLayout->DrawBase() = ImplLogicToDeviceFontCoordinate(rLogicalPos);
+        pSalLayout->DrawBase() = ImplLogicToDeviceSubPixel(rLogicalPos);
     else
     {
         Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos);
commit 990dd32a749cc402857535dbd94fccdb918c71a2
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Aug 23 20:16:02 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Aug 24 11:25:13 2022 +0200

    move & rename height relevant function near & similar to its width 
equivalent
    
    Change-Id: Icab3c11d6968efbbdb0f9f7f1dfeba2709e22a2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138746
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 5dab75f230d4..82b3180d212f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1718,6 +1718,7 @@ public:
      @returns Height in units of device pixels.
      */
     SAL_DLLPRIVATE tools::Long         ImplLogicHeightToDevicePixel( 
tools::Long nHeight ) const;
+    SAL_DLLPRIVATE double              
ImplLogicHeightToDeviceFontHeight(tools::Long nHeight) const;
 
     /** Convert device pixels to a width in logical units.
 
@@ -1838,19 +1839,6 @@ private:
      */
     SAL_DLLPRIVATE tools::Long         ImplLogicYToDevicePixel( tools::Long nY 
) const;
 
-    /** Convert logical height to device pixels, with exact sub-pixel value.
-
-     To get the \em exact pixel height, it must calculate the Y-DPI of the 
device and the
-     map scaling factor.
-
-     @param         fLogicHeight     Exact height in logical units.
-
-     @returns Exact height in pixels - returns as a float to provide for 
subpixel value.
-     */
-    SAL_DLLPRIVATE float        ImplFloatLogicHeightToDevicePixel( float 
fLogicHeight ) const;
-    ///@}
-
-
     /** @name Native Widget Rendering functions
 
         These all just call through to the private mpGraphics functions of the 
same name.
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index b2c501185b26..e8887169497e 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -864,7 +864,7 @@ bool OutputDevice::ImplNewFont() const
 
     // convert to pixel height
     // TODO: replace integer based aSize completely with subpixel accurate type
-    float fExactHeight = ImplFloatLogicHeightToDevicePixel( 
static_cast<float>(maFont.GetFontHeight()) );
+    float fExactHeight = 
ImplLogicHeightToDeviceFontHeight(maFont.GetFontHeight());
     Size aSize = ImplLogicToDevicePixel( maFont.GetFontSize() );
     if ( !aSize.Height() )
     {
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index bb4683f37a19..b6269916ad33 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -337,14 +337,6 @@ tools::Long OutputDevice::ImplLogicHeightToDevicePixel( 
tools::Long nHeight ) co
     return ImplLogicToPixel(nHeight, mnDPIY, maMapRes.mnMapScNumY, 
maMapRes.mnMapScDenomY);
 }
 
-float OutputDevice::ImplFloatLogicHeightToDevicePixel( float fLogicHeight) 
const
-{
-    if( !mbMap)
-        return fLogicHeight;
-    float fPixelHeight = (fLogicHeight * mnDPIY * maMapRes.mnMapScNumY) / 
maMapRes.mnMapScDenomY;
-    return fPixelHeight;
-}
-
 tools::Long OutputDevice::ImplDevicePixelToLogicWidth( tools::Long nWidth ) 
const
 {
     if ( !mbMap )
@@ -1894,6 +1886,15 @@ double 
OutputDevice::ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const
                             maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX);
 }
 
+double OutputDevice::ImplLogicHeightToDeviceFontHeight(tools::Long nHeight) 
const
+{
+    if (!mbMap)
+        return nHeight;
+
+    return ImplLogicToPixel(static_cast<double>(nHeight), mnDPIY,
+                            maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY);
+}
+
 DevicePoint OutputDevice::ImplLogicToDeviceFontCoordinate(const Point& rPoint) 
const
 {
     if (!mbMap)

Reply via email to