[Libreoffice-commits] core.git: 2 commits - include/svx svx/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 16 07:55:31 UTC 2019
include/svx/svdpntv.hxx | 3 +
svx/source/svdraw/sdrpaintwindow.cxx | 92 ++++++++++++++++++-----------------
vcl/unx/gtk3/gtk3gtkinst.cxx | 4 +
3 files changed, 54 insertions(+), 45 deletions(-)
New commits:
commit a399853f864ace2d4bd7e9a3a3b3eeb8a2379e4a
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 15 15:58:55 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 16 09:54:58 2019 +0200
refactor to move overlay creation to SdrPaintView
Change-Id: Idbb734a44289d7ecead84f3c4ac2bc1ebc44ef40
Reviewed-on: https://gerrit.libreoffice.org/72381
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index 429e9b96f020..43bcd34e234f 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -43,6 +43,7 @@ class SdrPageWindow;
namespace com { namespace sun { namespace star { namespace awt {
class XControlContainer;
}}}}
+namespace sdr { namespace overlay { class OverlayManager; } }
class SdrPage;
class SdrView;
@@ -220,6 +221,8 @@ public:
bool IsPagePaintingAllowed() const { return mbPagePaintingAllowed;}
void SetPagePaintingAllowed(bool bNew);
+ rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const;
+
protected:
svtools::ColorConfig maColorConfig;
Color maGridColor;
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 711da48c53b7..060437fa77a1 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -168,59 +168,63 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
mpPreRenderDevice->EnableMapMode(bMapModeWasEnabledSource);
}
-
-void SdrPaintWindow::impCreateOverlayManager()
+rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager(OutputDevice& rOutputDevice) const
{
- // not yet one created?
- if(!mxOverlayManager.is())
+ rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager;
+ // is it a window?
+ if (OUTDEV_WINDOW == rOutputDevice.GetOutDevType())
{
- // is it a window?
- if(OUTDEV_WINDOW == GetOutputDevice().GetOutDevType())
+ vcl::Window& rWindow = dynamic_cast<vcl::Window&>(rOutputDevice);
+ // decide which OverlayManager to use
+ if (IsBufferedOverlayAllowed() && !rWindow.SupportsDoubleBuffering())
{
- vcl::Window& rWindow = dynamic_cast<vcl::Window&>(GetOutputDevice());
- // decide which OverlayManager to use
- if(GetPaintView().IsBufferedOverlayAllowed() && !rWindow.SupportsDoubleBuffering())
- {
- // buffered OverlayManager, buffers its background and refreshes from there
- // for pure overlay changes (no system redraw). The 3rd parameter specifies
- // whether that refresh itself will use a 2nd vdev to avoid flickering.
- // Also hand over the old OverlayManager if existent; this means to take over
- // the registered OverlayObjects from it
- mxOverlayManager = sdr::overlay::OverlayManagerBuffered::create(GetOutputDevice());
- }
- else
- {
- // unbuffered OverlayManager, just invalidates places where changes
- // take place
- // Also hand over the old OverlayManager if existent; this means to take over
- // the registered OverlayObjects from it
- mxOverlayManager = sdr::overlay::OverlayManager::create(GetOutputDevice());
- }
+ // buffered OverlayManager, buffers its background and refreshes from there
+ // for pure overlay changes (no system redraw). The 3rd parameter specifies
+ // whether that refresh itself will use a 2nd vdev to avoid flickering.
+ // Also hand over the old OverlayManager if existent; this means to take over
+ // the registered OverlayObjects from it
+ xOverlayManager = sdr::overlay::OverlayManagerBuffered::create(rOutputDevice);
+ }
+ else
+ {
+ // unbuffered OverlayManager, just invalidates places where changes
+ // take place
+ // Also hand over the old OverlayManager if existent; this means to take over
+ // the registered OverlayObjects from it
+ xOverlayManager = sdr::overlay::OverlayManager::create(rOutputDevice);
+ }
- OSL_ENSURE(mxOverlayManager.is(), "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)");
+ OSL_ENSURE(xOverlayManager.is(), "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)");
- // Request a repaint so that the buffered overlay manager fills
- // its buffer properly. This is a workaround for missing buffer
- // updates.
- if (!comphelper::LibreOfficeKit::isActive())
- {
- rWindow.Invalidate();
- }
+ // Request a repaint so that the buffered overlay manager fills
+ // its buffer properly. This is a workaround for missing buffer
+ // updates.
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ rWindow.Invalidate();
+ }
- Color aColA(GetPaintView().getOptionsDrawinglayer().GetStripeColorA());
- Color aColB(GetPaintView().getOptionsDrawinglayer().GetStripeColorB());
+ Color aColA(getOptionsDrawinglayer().GetStripeColorA());
+ Color aColB(getOptionsDrawinglayer().GetStripeColorB());
- if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor();
- aColB.Invert();
- }
-
- mxOverlayManager->setStripeColorA(aColA);
- mxOverlayManager->setStripeColorB(aColB);
- mxOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength());
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor();
+ aColB.Invert();
}
+
+ xOverlayManager->setStripeColorA(aColA);
+ xOverlayManager->setStripeColorB(aColB);
+ xOverlayManager->setStripeLengthPixel(getOptionsDrawinglayer().GetStripeLength());
}
+ return xOverlayManager;
+}
+
+void SdrPaintWindow::impCreateOverlayManager()
+{
+ // not yet one created?
+ if(!mxOverlayManager.is())
+ mxOverlayManager = GetPaintView().CreateOverlayManager(GetOutputDevice());
}
SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow)
commit bb34fed5b4cec43811a733e197137c2ac05f47c4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 15 16:44:35 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 16 09:54:46 2019 +0200
convert back from logic to pixel for queue_draw_area
Change-Id: Ideb0f4066629dec0c6375a01897c0c8d6e2ff524
Reviewed-on: https://gerrit.libreoffice.org/72380
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a4d89c8bc0f8..dac1bccae151 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8406,7 +8406,9 @@ public:
virtual void queue_draw_area(int x, int y, int width, int height) override
{
- gtk_widget_queue_draw_area(GTK_WIDGET(m_pDrawingArea), x, y, width, height);
+ tools::Rectangle aRect(Point(x, y), Size(width, height));
+ aRect = m_xDevice->LogicToPixel(aRect);
+ gtk_widget_queue_draw_area(GTK_WIDGET(m_pDrawingArea), aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight());
}
virtual void queue_resize() override
More information about the Libreoffice-commits
mailing list