comphelper/source/misc/lok.cxx | 2 +- desktop/source/lib/init.cxx | 8 +------- include/comphelper/lok.hxx | 4 ++-- sc/source/ui/unoobj/docuno.cxx | 10 +++++----- sc/source/ui/view/gridwin4.cxx | 31 +++++++++---------------------- 5 files changed, 18 insertions(+), 37 deletions(-)
New commits: commit ebad4dec8c7e7427b3dbb3536ca3899a44e09f09 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Oct 28 20:43:46 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Tue Nov 5 21:50:00 2019 +0100 Revert "sc lok: Implement hi-dpi and zoom for spreadsheets." This reverts commit 498dceb43f870bf9e380f1f87e99c6ccadf1963c. Change-Id: Iadb9da47cf8c9a57385530ab888d55169db7639a Reviewed-on: https://gerrit.libreoffice.org/82095 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index 5f5fc31d4421..4fa7a6f8bddc 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -41,7 +41,7 @@ static Compat g_eCompatFlags(Compat::none); static LanguageTag g_aLanguageTag("en-US", true); -/// Scaling of the cairo or CoreGraphics canvas painting for hi-dpi or zooming in Calc. +/// Scaling of the cairo or CoreGraphics canvas painting for hi-dpi static double g_fDPIScale(1.0); /// List of <viewid, bMobile> pairs diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index abe37f9356dd..bac4319a778d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2723,15 +2723,9 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, // would do - because that one is trying to fit the lines between cells to integer multiples of // pixels. comphelper::ScopeGuard dpiScaleGuard([]() { comphelper::LibreOfficeKit::setDPIScale(1.0); }); - double fDPIScaleX = 1.0; - if (doc_getDocumentType(pThis) == LOK_DOCTYPE_SPREADSHEET) - { - fDPIScaleX = (nCanvasWidth * 3840.0) / (256.0 * nTileWidth); - assert(fabs(fDPIScaleX - ((nCanvasHeight * 3840.0) / (256.0 * nTileHeight))) < 0.0001); - comphelper::LibreOfficeKit::setDPIScale(fDPIScaleX); - } #if defined(IOS) + double fDPIScaleX = 1.0; paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #else ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ; diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index babe15ecb4b5..b4658913f0d1 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -65,9 +65,9 @@ COMPHELPER_DLLPUBLIC void setTiledPainting(bool bTiledPainting); COMPHELPER_DLLPUBLIC bool isDialogPainting(); /// Set if we are painting the dialog. COMPHELPER_DLLPUBLIC void setDialogPainting(bool bDialogPainting); -/// Set the DPI scale for rendering for hi-dpi displays. Used also for zoom in Calc. +/// Set the DPI scale for rendering for HiDPI displays. COMPHELPER_DLLPUBLIC void setDPIScale(double fDPIScale); -/// Get the DPI scale for rendering for hi-dpi displays. Used also for zoom in Calc. +/// Get the DPI scale for rendering for HiDPI displays. COMPHELPER_DLLPUBLIC double getDPIScale(); /// Set if we want no annotations rendering COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index ce98a24bd784..db81b7ea7772 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -894,12 +894,12 @@ bool ScModelObj::isMimeTypeSupported() return EditEngine::HasValidData(aDataHelper.GetTransferable()); } -void ScModelObj::setClientZoom(int /*nTilePixelWidth_*/, int /*nTilePixelHeight_*/, int /*nTileTwipWidth_*/, int /*nTileTwipHeight_*/) +void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) { - mnTilePixelWidth = 256; - mnTilePixelHeight = 256; - mnTileTwipWidth = mnTilePixelWidth * TWIPS_PER_PIXEL; - mnTileTwipHeight = mnTilePixelHeight * TWIPS_PER_PIXEL; + mnTilePixelWidth = nTilePixelWidth_; + mnTilePixelHeight = nTilePixelHeight_; + mnTileTwipWidth = nTileTwipWidth_; + mnTileTwipHeight = nTileTwipHeight_; } OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 3271139cdbb7..75111de74eae 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1113,30 +1113,17 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // coords only, and avoid all the SetMapMode()'s. // Similarly to Writer, we should set the mapmode once on the rDevice, and // not care about any zoom settings. - // - // But until that happens, we actually draw everything at 100%, and only - // set cairo's or CoreGraphic's scale factor accordingly, so that everything - // is painted bigger or smaller. This is different to what Calc's internal - // scaling would do - because that one is trying to fit the lines between - // cells to integer multiples of pixels. - // - // See also desktop/source/lib/init.cxx for details, where we have to set - // the stuff accordingly for the VirtualDevice creation. - - // page break zoom, and aLogicMode in ScViewData - hardcode that to what - // we mean as 100% (256px tiles meaning 3840 twips) - Fraction aFracX(long(256 * TWIPS_PER_PIXEL), 3840); - Fraction aFracY(long(256 * TWIPS_PER_PIXEL), 3840); - pViewData->SetZoom(aFracX, aFracY, true); - // Cairo or CoreGraphics scales for us, we have to compensate for that, - // otherwise we are painting too far away - const double fDPIScale = comphelper::LibreOfficeKit::getDPIScale(); + Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); + Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); + + // page break zoom, and aLogicMode in ScViewData + pViewData->SetZoom(aFracX, aFracY, true); - const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / (nTileWidth * fDPIScale); - const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / (nTileHeight * fDPIScale); - const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / (nTileHeight * fDPIScale); - const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / (nTileWidth * fDPIScale); + const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth; + const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight; + const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight; + const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth; SCTAB nTab = pViewData->GetTabNo(); ScDocument* pDoc = pViewData->GetDocument(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits