diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-03 17:27:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-04 21:49:22 +0100 |
commit | 955fd7d8dc9da29717371c8fcb25d9954ff975bd (patch) | |
tree | b33f36cb8e8161ee490c94d38f7067d7e3c71347 | |
parent | 948207edfbb6a8bcce2573ec758bacf818bbd2c7 (diff) |
split rect arg into dest pos and source rect
Change-Id: I622979fa54e54f1c6e00b5a16546fdbc12957422
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110383
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 15 | ||||
-rw-r--r-- | vcl/source/control/InterimItemWindow.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 8 |
5 files changed, 16 insertions, 15 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 70a340c85b30..18e0cd6abdbc 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -315,7 +315,7 @@ public: virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) = 0; // render the widget to an output device - virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) = 0; + virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) = 0; virtual ~Widget() {} }; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 8d8138690bf1..6f3fccc87005 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -366,7 +366,7 @@ public: virtual void set_background(const Color& rColor) override; - virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) override; + virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) override; SystemWindow* getSystemWindow(); }; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e9e675e1645b..c1ac2432ff7c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1188,7 +1188,7 @@ void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOu bool bRVisible = pImpl->mbReallyVisible; pImpl->mbReallyVisible = pWindow->IsVisible(); - pWindow->Paint(*xOutput, tools::Rectangle(Point(), aSize)); + pWindow->Paint(*xOutput, tools::Rectangle(Point(), pWindow->PixelToLogic(aSize))); pImpl->mbReallyVisible = bRVisible; @@ -1201,19 +1201,22 @@ void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOu { if (!pChild->IsVisible()) continue; - DoRecursivePaint(pChild, rPos + pChild->GetPosPixel(), rOutput); + DoRecursivePaint(pChild, rPos + rOutput.PixelToLogic(pChild->GetPosPixel()), rOutput); } } } -void SalInstanceWidget::draw(OutputDevice& rOutput, const tools::Rectangle& rRect) +void SalInstanceWidget::draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) { Size aOrigSize(m_xWidget->GetSizePixel()); + bool bChangeSize = aOrigSize != rSizePixel; + if (bChangeSize) + m_xWidget->SetSizePixel(rSizePixel); - m_xWidget->SetSizePixel(rRect.GetSize()); - DoRecursivePaint(m_xWidget, rRect.TopLeft(), rOutput); + DoRecursivePaint(m_xWidget, rPos, rOutput); - m_xWidget->SetSizePixel(aOrigSize); + if (bChangeSize) + m_xWidget->SetSizePixel(aOrigSize); } namespace diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx index 97d64b617648..3817e01893f1 100644 --- a/vcl/source/control/InterimItemWindow.cxx +++ b/vcl/source/control/InterimItemWindow.cxx @@ -163,9 +163,7 @@ bool InterimItemWindow::ChildKeyInput(const KeyEvent& rKEvt) void InterimItemWindow::Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags /*nFlags*/) { - if (!m_pWidget) - return; - m_pWidget->draw(*pDevice, tools::Rectangle(rPos, GetSizePixel())); + m_xContainer->draw(*pDevice, rPos, GetSizePixel()); } void InterimItemWindow::ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index cfd8eacabff4..967531bfc4d4 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3152,7 +3152,7 @@ public: return xRet; } - virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) override + virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rPixelSize) override { // detect if we have to manually setup its size bool bAlreadyRealized = gtk_widget_get_realized(m_pWidget); @@ -3177,7 +3177,7 @@ public: if (bAnimations) g_object_set(pSettings, "gtk-enable-animations", false, nullptr); - Size aSize(rRect.GetSize()); + Size aSize(rPixelSize); GtkAllocation aOrigAllocation; gtk_widget_get_allocation(m_pWidget, &aOrigAllocation); @@ -3193,7 +3193,7 @@ public: VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT)); xOutput->SetOutputSizePixel(aSize); - xOutput->DrawOutDev(Point(), aSize, rRect.TopLeft(), aSize, rOutput); + xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput); cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput); cairo_t* cr = cairo_create(pSurface); @@ -3205,7 +3205,7 @@ public: gtk_widget_set_allocation(m_pWidget, &aOrigAllocation); gtk_widget_size_allocate(m_pWidget, &aOrigAllocation); - rOutput.DrawOutDev(rRect.TopLeft(), aSize, Point(), aSize, *xOutput); + rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput); if (bAnimations) g_object_set(pSettings, "gtk-enable-animations", true, nullptr); |