[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 4 20:50:11 UTC 2021
include/vcl/weld.hxx | 2 +-
vcl/inc/salvtables.hxx | 2 +-
vcl/source/app/salvtables.cxx | 15 +++++++++------
vcl/source/control/InterimItemWindow.cxx | 4 +---
vcl/unx/gtk3/gtk3gtkinst.cxx | 8 ++++----
5 files changed, 16 insertions(+), 15 deletions(-)
New commits:
commit 955fd7d8dc9da29717371c8fcb25d9954ff975bd
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 3 17:27:02 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 4 21:49:22 2021 +0100
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 at redhat.com>
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);
More information about the Libreoffice-commits
mailing list