comphelper/source/misc/lok.cxx | 24 +++++++++++++++++++++ include/comphelper/lok.hxx | 12 ++++++++++ sc/source/ui/view/gridwin4.cxx | 1 svx/source/sdr/contact/objectcontactofpageview.cxx | 9 +++++-- vcl/source/outdev/bitmap.cxx | 4 +-- 5 files changed, 45 insertions(+), 5 deletions(-)
New commits: commit c337011d2052ec3ddb80e61bcc4b0574b4e898ba Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Thu Jun 16 07:28:58 2016 -0400 LOK: tile rendering regression fix Calc fast rendering requires us to offset the are being rendered and shift all bitmaps accordingly. This however is breaking Impress rendering since the offseting logic is common (in svx and vcl). This adds new API to enable or disable this local rendering (as opposed to rendering a full document as was previously done. The new flag is then set by Calc to enable the offseting logic in isolation without affecting other applications. In one case isolation was achieved by checking the MapModeUnit. Change-Id: Ia0aadfc3f6df7c1a891b97dc731f5897414c9420 Reviewed-on: https://gerrit.libreoffice.org/26367 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> (cherry picked from commit 60fdcda65bad242f99895cb453182578250fbdea) Reviewed-on: https://gerrit.libreoffice.org/26378 Tested-by: Jenkins <c...@libreoffice.org> diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index a6abd2a..a321260 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -17,6 +17,8 @@ namespace LibreOfficeKit static bool g_bActive(false); +static bool g_bViewCallback(true); + void setActive(bool bActive) { g_bActive = bActive; @@ -27,6 +29,28 @@ bool isActive() return g_bActive; } +void setViewCallback(bool bViewCallback) +{ + g_bViewCallback = bViewCallback; +} + +bool isViewCallback() +{ + return g_bViewCallback; +} + +static bool g_bLocalRendering(false); + +void setLocalRendering(bool bLocalRendering) +{ + g_bLocalRendering = bLocalRendering; +} + +bool isLocalRendering() +{ + return g_bLocalRendering; +} + static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr); static void *pStatusIndicatorCallbackData(nullptr); diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index 79fa115..8afd3d8 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -36,6 +36,18 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data // Check whether the code is running as invoked through LibreOfficeKit. COMPHELPER_DLLPUBLIC bool isActive(); +/// Shift the coordinates before rendering each bitmap. +/// Used by Calc to render each tile separately. +/// This should be unnecessary (and removed) once Calc +/// moves to using 100MM Unit. +COMPHELPER_DLLPUBLIC void setLocalRendering(bool bLocalRendering = true); +COMPHELPER_DLLPUBLIC bool isLocalRendering(); + +/// Check whether clients register a callback for each view. +COMPHELPER_DLLPUBLIC bool isViewCallback(); +/// Set whether clients register a callback for each view. +COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback); + // Status indicator handling. Even if in theory there could be several status indicators active at // the same time, in practice there is only one at a time, so we don't handle any identification of // status indicator in this API. diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 39999bd..df98ab9 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -826,6 +826,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aOrigin.getY() - aOrigin.getY() / twipFactor); aNew.SetOrigin(aOrigin); pContentDev->SetMapMode(aNew); + comphelper::LibreOfficeKit::setLocalRendering(); } DrawRedraw( aOutputData, eMode, SC_LAYER_FRONT ); diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index cead940..589c292 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -232,7 +232,8 @@ namespace sdr // transform to world coordinates aViewRange.transform(rTargetOutDev.GetInverseViewTransformation()); - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && + comphelper::LibreOfficeKit::isLocalRendering()) { const int TWIPS_PER_PIXEL = 15; aViewRange = basegfx::B2DRange(aViewRange.getMinimum().getX(), @@ -309,7 +310,8 @@ namespace sdr drawinglayer::processor2d::createProcessor2DFromOutputDevice( rTargetOutDev, getViewInformation2D())); - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && + comphelper::LibreOfficeKit::isLocalRendering()) { // Restore the origin. MapMode aMapMode = pOutDev->GetMapMode(); @@ -322,7 +324,8 @@ namespace sdr pProcessor2D->process(xPrimitiveSequence); } - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && + comphelper::LibreOfficeKit::isLocalRendering()) { // Restore the original map-mode. pOutDev->SetMapMode(aOrigMapMode); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index fae4c6a..31b25a2 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1199,14 +1199,14 @@ void OutputDevice::DrawTransformedBitmapEx( basegfx::fround(aScale.getX() + aTranslate.getX()) - aDestPt.X(), basegfx::fround(aScale.getY() + aTranslate.getY()) - aDestPt.Y()); const Point aOrigin = GetMapMode().GetOrigin(); - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MAP_PIXEL) { aDestPt.Move(aOrigin.getX(), aOrigin.getY()); EnableMapMode(false); } DrawBitmapEx(aDestPt, aDestSize, rBitmapEx); - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MAP_PIXEL) { EnableMapMode(); aDestPt.Move(-aOrigin.getX(), -aOrigin.getY()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits