Kaydet (Commit) 25eddbb2 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

Avoid mixing up units in LogicRectangle method

For main document window we use logic coordinates, but
for dialog / floating windows we use pixels. Use a different
method name to make it clear which unit we use in the code.

Change-Id: I7aee7a03013d24e1a2e37072e224e7d4e7830f02
Reviewed-on: https://gerrit.libreoffice.org/54500Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 7a77d927
......@@ -130,7 +130,7 @@ public:
SAL_DLLPRIVATE tools::Rectangle& ImplGetItemEdgeClipRect();
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
virtual void doDeferredInit(WinBits nBits) override;
void LogicInvalidate(const tools::Rectangle* pRectangle) override;
void PixelInvalidate(const tools::Rectangle* pRectangle) override;
public:
explicit FloatingWindow(vcl::Window* pParent, WinBits nStyle);
......
......@@ -1074,11 +1074,20 @@ public:
virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
/**
* Notification about some rectangle of the output device got invalidated.
* Notification about some rectangle of the output device got invalidated.Used for the main
* document window.
*
* @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
*/
virtual void LogicInvalidate(const tools::Rectangle* pRectangle);
/**
* Notification about some rectangle of the output device got invalidated. Used for the
* dialogs and floating windows (e.g. conext menu, popup).
*
* @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
*/
virtual void PixelInvalidate(const tools::Rectangle* pRectangle);
void Validate();
bool HasPaintEvent() const;
void Update();
......
......@@ -590,7 +590,7 @@ bool FloatingWindow::EventNotify( NotifyEvent& rNEvt )
return bRet;
}
void FloatingWindow::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
void FloatingWindow::PixelInvalidate(const tools::Rectangle* /*pRectangle*/)
{
if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
......
......@@ -1188,6 +1188,17 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
}
void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
{
if(pRectangle)
{
tools::Rectangle aRect = GetOutDev()->ImplLogicToDevicePixel( *pRectangle );
PixelInvalidate(&aRect);
}
else
PixelInvalidate(nullptr);
}
void Window::PixelInvalidate(const tools::Rectangle* pRectangle)
{
if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive())
return;
......@@ -1210,7 +1221,7 @@ void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
else if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), GetSizePixel());
pParent->LogicInvalidate(&aRect);
pParent->PixelInvalidate(&aRect);
}
}
......
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