[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source

Jan Holesovsky kendy at collabora.com
Mon May 18 09:35:45 PDT 2015


 include/vcl/window.hxx       |    5 +++++
 vcl/inc/window.h             |    3 ++-
 vcl/source/window/paint.cxx  |    4 ++--
 vcl/source/window/window.cxx |   11 +++++++++++
 4 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 0fc56aad09861a6d94246a3fa047fef70c79f8d9
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon May 18 18:30:44 2015 +0200

    rendercontext: Per-widget double-buffering for the cases we know that work.
    
    Uses a variable, not a virtual method, as any change would need a large
    re-compile.
    
    Change-Id: I103669b139a82137c5d346ab8c9459483d358f2b

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index f7615e3..c86ecb8 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -785,6 +785,11 @@ public:
     bool                                IsDisposed() const;
     SystemWindow*                       GetSystemWindow() const;
 
+    /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
+    bool                                SupportsDoubleBuffering() const;
+    /// Mark this window / widget derived from this window as working with double-buffering via RenderContext.
+    void                                SetDoubleBuffering(bool bDoubleBuffering = true);
+
     void                                EnableAllResize( bool bEnable = true );
 
     void                                SetBorderStyle( WindowBorderStyle nBorderStyle );
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index d73f3e1..48fea9e 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -368,7 +368,8 @@ public:
                         mbExpand:1,
                         mbFill:1,
                         mbSecondary:1,
-                        mbNonHomogeneous:1;
+                        mbNonHomogeneous:1,
+                        mbDoubleBuffering:1;
 
     vcl::RenderSettings maRenderSettings;
 
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 2ee0dba..4f7f9dd 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -124,8 +124,8 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
     {
         m_pWindow->BeginPaint();
 
-        // double-buffering - so far an experimental feature
-        if (officecfg::Office::Common::Misc::ExperimentalMode::get())
+        // double-buffering: normally just a selected subset
+        if (m_pWindow->SupportsDoubleBuffering() || officecfg::Office::Common::Misc::ExperimentalMode::get())
         {
             m_pWindow->PushPaintHelper(this, *m_pWindow);
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 730cb03..34aa285 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -751,6 +751,7 @@ WindowImpl::WindowImpl( WindowType nType )
     mbFill                              = true;
     mbSecondary                         = false;
     mbNonHomogeneous                    = false;
+    mbDoubleBuffering                   = false; // when we are not sure, assume it cannot do double-buffering via RenderContext
 }
 
 WindowImpl::~WindowImpl()
@@ -3935,6 +3936,16 @@ vcl::RenderSettings& Window::GetRenderSettings()
     return mpWindowImpl->maRenderSettings;
 }
 
+bool Window::SupportsDoubleBuffering() const
+{
+    return mpWindowImpl->mbDoubleBuffering;
+}
+
+void Window::SetDoubleBuffering(bool bDoubleBuffering)
+{
+    mpWindowImpl->mbDoubleBuffering = bDoubleBuffering;
+}
+
 } /* namespace vcl */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list