From 498dceb43f870bf9e380f1f87e99c6ccadf1963c Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 23 Oct 2018 17:20:38 +0200 Subject: sc lok: Implement hi-dpi and zoom for spreadsheets. A bit different approach than trying to paint different zoom levels at the samet time, because it is terribly hard to achieve with Calc - things misalign, because Calc tries to fit the lines into the pixels etc. Instead, always paint the spreadsheet at 100%, but use cairo to scale the actual painting. Change-Id: I228a9dd41bf29862bdd188825d12e61e1c86cccc Reviewed-on: https://gerrit.libreoffice.org/63031 Tested-by: Jenkins Reviewed-by: Jan Holesovsky --- vcl/headless/svpvd.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'vcl/headless') diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index 4172fc383744..875f22a5d7fc 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -25,6 +25,7 @@ #include #include +#include #include @@ -90,9 +91,17 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) double fXScale, fYScale; - cairo_surface_get_device_scale(m_pRefSurface, &fXScale, &fYScale); - nNewDX *= fXScale; - nNewDY *= fYScale; + if (comphelper::LibreOfficeKit::isActive()) + { + // Force scaling of the painting + fXScale = fYScale = comphelper::LibreOfficeKit::getDPIScale(); + } + else + { + cairo_surface_get_device_scale(m_pRefSurface, &fXScale, &fYScale); + nNewDX *= fXScale; + nNewDY *= fYScale; + } #endif m_pSurface = cairo_image_surface_create_for_data(pBuffer, CAIRO_FORMAT_ARGB32, -- cgit