summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-11 13:13:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-11 14:19:24 +0200
commitbfed58821fc3a83fec4a985087cd45fa963bed3e (patch)
tree427156ed03b2b72069e47d9f1250dc36670c09cf /vcl
parentc46950fee11f5207fb8324947280cd565ae483e7 (diff)
Drop convertMm100ToTwip in favor of the new o3tl::toTwips
Step by step, duplicates from <tools/UnitConversion.hxx> may go Change-Id: Id4c03ff8adc120ae06dbfdbdfb4f5ff0bb51f489 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120315 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 87af9c6c5c90..e1206e985eaa 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -26,7 +26,7 @@ namespace
/// Convert to inch, then assume 96 DPI.
inline double pointToPixel(const double fPoint, const double fResolutionDPI)
{
- return fPoint * fResolutionDPI / 72.;
+ return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * fResolutionDPI;
}
/// Decide if PDF data is old enough to be compatible.
@@ -159,13 +159,15 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<BitmapEx>& r
break;
// Calculate the bitmap size in points.
- size_t nPageWidthPoints = pPdfPage->getWidth();
- size_t nPageHeightPoints = pPdfPage->getHeight();
+ double nPageWidthPoints = pPdfPage->getWidth();
+ double nPageHeightPoints = pPdfPage->getHeight();
if (pSizeHint && pSizeHint->getX() && pSizeHint->getY())
{
// Have a size hint, prefer that over the logic size from the PDF.
- nPageWidthPoints = convertMm100ToTwip(pSizeHint->getX()) / 20;
- nPageHeightPoints = convertMm100ToTwip(pSizeHint->getY()) / 20;
+ nPageWidthPoints
+ = o3tl::convert(pSizeHint->getX(), o3tl::Length::mm100, o3tl::Length::pt);
+ nPageHeightPoints
+ = o3tl::convert(pSizeHint->getY(), o3tl::Length::mm100, o3tl::Length::pt);
}
// Returned unit is points, convert that to pixel.