Kaydet (Commit) 7b8a5980 authored tarafından Miklos Vajna's avatar Miklos Vajna

sd: when tiled rendering, disable map mode early

This brings sd in sync with sw, that does the same for some time
already. With this, we no longer do a complete repaint 6 times after
every postMouseEvent().

Change-Id: I38754f4bdbb977abbdbb0f32e1460ab2f6290f87
üst 35cf00e2
......@@ -922,7 +922,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16
Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight());
// LOK output is always in twips, convert from mm100 if necessary.
if (pOutWin->IsMapModeEnabled() && pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM)
if (pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM)
aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP);
// Let the LOK client decide the cursor width.
aRect.setWidth(0);
......
......@@ -90,6 +90,7 @@
#include "ClientView.hxx"
#include "DrawViewShell.hxx"
#include "ViewShell.hxx"
#include "Window.hxx"
#include "app.hrc"
#include <vcl/pdfextoutdevdata.hxx>
#include <com/sun/star/presentation/AnimationEffect.hpp>
......@@ -2359,6 +2360,16 @@ void SdXImpressDocument::initializeForTiledRendering()
mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
mpDoc->setTiledRendering(true);
// Disable map mode, so that it's possible to send mouse event coordinates
// in logic units.
if (DrawViewShell* pViewShell = GetViewShell())
{
if (sd::Window* pWindow = pViewShell->GetActiveWindow())
{
pWindow->EnableMapMode(false);
}
}
}
void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData)
......
......@@ -324,10 +324,13 @@ long Window::SetZoomFactor(long nZoom)
nZoom = mnMinZoom;
// Set the zoom factor at the window's map mode.
MapMode aMap(GetMapMode());
aMap.SetScaleX(Fraction(nZoom, 100));
aMap.SetScaleY(Fraction(nZoom, 100));
SetMapMode(aMap);
if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
{
MapMode aMap(GetMapMode());
aMap.SetScaleX(Fraction(nZoom, 100));
aMap.SetScaleY(Fraction(nZoom, 100));
SetMapMode(aMap);
}
// invalidate previous size - it was relative to the old scaling
maPrevSize = Size(-1,-1);
......@@ -559,7 +562,8 @@ void Window::UpdateMapOrigin(bool bInvalidate)
maPrevSize = aWinSize;
if (bChanged && bInvalidate)
// When tiled rendering, the above UpdateMapMode() call doesn't touch the map mode.
if (bChanged && bInvalidate && (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering()))
Invalidate();
}
......@@ -599,9 +603,12 @@ void Window::UpdateMapMode (void)
Point aNewOrigin (-maWinPos.X(), -maWinPos.Y());
maWinPos += maViewOrigin;
MapMode aMap(GetMapMode());
aMap.SetOrigin(aNewOrigin);
SetMapMode(aMap);
if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
{
MapMode aMap(GetMapMode());
aMap.SetOrigin(aNewOrigin);
SetMapMode(aMap);
}
}
/**
......
......@@ -392,8 +392,10 @@ void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
mpContentWindow->SetWinViewPos(aNewPos);
mpContentWindow->UpdateMapOrigin();
// #i74769# see above
mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
// When tiled rendering, UpdateMapOrigin() doesn't touch the map mode.
if (!GetDoc()->isTiledRendering())
// #i74769# see above
mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
}
Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
......
......@@ -510,15 +510,12 @@ void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
bool bMap = mpActiveWindow->IsMapModeEnabled();
mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel());
MouseButtonDown(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
......@@ -526,15 +523,12 @@ void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
bool bMap = mpActiveWindow->IsMapModeEnabled();
mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel());
MouseButtonUp(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment