[Libreoffice-commits] core.git: Branch 'feature/rendercontext' - include/vcl vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Apr 28 19:19:21 PDT 2015


 include/vcl/prgsbar.hxx        |    3 ++-
 vcl/source/control/prgsbar.cxx |   15 +++++++++------
 vcl/source/control/scrbar.cxx  |    4 ++--
 3 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit e6c2951f1957224aa0e7dc97b33b0450c41f92f7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Apr 29 11:08:24 2015 +0900

    delegate RenderContext, invalidate - prgsbar, scrbar
    
    Change-Id: I05d68be744044cc82c0397fac25518a53c270761

diff --git a/include/vcl/prgsbar.hxx b/include/vcl/prgsbar.hxx
index 6cce19c..28fbec3 100644
--- a/include/vcl/prgsbar.hxx
+++ b/include/vcl/prgsbar.hxx
@@ -63,12 +63,13 @@ private:
     long                mnPrgsHeight;
     sal_uInt16          mnPercent;
     sal_uInt16          mnPercentCount;
+    sal_uInt16          mnPreviousPercent;
     bool                mbCalcNew;
 
     using Window::ImplInit;
     SAL_DLLPRIVATE void             ImplInit();
     SAL_DLLPRIVATE void             ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
-    SAL_DLLPRIVATE void             ImplDrawProgress( sal_uInt16 nOldPerc, sal_uInt16 nNewPerc );
+    SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nOldPerc, sal_uInt16 nNewPerc);
 
 public:
                         ProgressBar( vcl::Window* pParent, WinBits nWinBits = WB_STDPROGRESSBAR );
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index 8bdf2fe..609911c 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -27,8 +27,9 @@
 
 void ProgressBar::ImplInit()
 {
-    mnPercent   = 0;
-    mbCalcNew   = true;
+    mnPercent = 0;
+    mnPreviousPercent = 0;
+    mbCalcNew = true;
 
     ImplInitSettings( true, true, true );
 }
@@ -116,7 +117,7 @@ void ProgressBar::ImplInitSettings( bool bFont,
     }
 }
 
-void ProgressBar::ImplDrawProgress( sal_uInt16 nOldPerc, sal_uInt16 nNewPerc )
+void ProgressBar::ImplDrawProgress(vcl::RenderContext& /*rRenderContext*/, sal_uInt16 nOldPerc, sal_uInt16 nNewPerc)
 {
     if ( mbCalcNew )
     {
@@ -145,9 +146,9 @@ void ProgressBar::ImplDrawProgress( sal_uInt16 nOldPerc, sal_uInt16 nNewPerc )
                     Rectangle( Point(), GetSizePixel() ) );
 }
 
-void ProgressBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void ProgressBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
 {
-    ImplDrawProgress( 0, mnPercent );
+    ImplDrawProgress(rRenderContext, mnPreviousPercent, mnPercent);
 }
 
 void ProgressBar::Resize()
@@ -165,6 +166,7 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
     {
         mbCalcNew = true;
         mnPercent = nNewPercent;
+        mnPreviousPercent = 0;
         if ( IsReallyVisible() )
         {
             Invalidate();
@@ -173,8 +175,9 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
     }
     else
     {
-        ImplDrawProgress( mnPercent, nNewPercent );
+        mnPreviousPercent = mnPercent;
         mnPercent = nNewPercent;
+        Invalidate();
     }
 }
 
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 6f883bf..0d71783 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1120,9 +1120,9 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt )
         Control::KeyInput( rKEvt );
 }
 
-void ScrollBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void ScrollBar::Paint( vcl::RenderContext& rRenderContext, const Rectangle& )
 {
-    ImplDraw( SCRBAR_DRAW_ALL, this );
+    ImplDraw(SCRBAR_DRAW_ALL, &rRenderContext);
 }
 
 void ScrollBar::Resize()


More information about the Libreoffice-commits mailing list