[Libreoffice-commits] core.git: vcl/workben

Tor Lillqvist tml at collabora.com
Fri Oct 10 11:20:38 PDT 2014


 vcl/workben/icontest.cxx |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 4fd547e61ef97ca15fb5474044ee91cffda6e389
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Oct 10 21:16:24 2014 +0300

    Add some silly looping and timing
    
    Change-Id: Ibfb77e7d5fb32c317e773851536444679e5b65fa

diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 6e8bd7e..10253c7 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -10,7 +10,8 @@
 /*
  * =======================================================================
  *
- * This is a quick hack to test some stuff. Work in progress. Don't touch.
+ * This is a quick hack to test some stuff. Work in progress. Don't touch
+ * and don't bother inspecting too closely.
  *
  * =======================================================================
  */
@@ -45,13 +46,27 @@ using namespace com::sun::star;
 
 namespace {
     const int WIDTH = 1000, HEIGHT = 800;
+
+    double getTimeNow()
+    {
+        TimeValue aValue;
+        osl_getSystemTime(&aValue);
+        return (double)aValue.Seconds +
+            (double)aValue.Nanosec / (1000*1000*1000);
+    }
+
 }
 
 class MyWorkWindow : public WorkWindow
 {
+protected:
+    double nStartTime;
+    int nPaintCount;
+
 public:
     MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
 
+    virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     virtual void Resize() SAL_OVERRIDE;
 };
 
@@ -69,15 +84,23 @@ public:
     MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
 
     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
-
 };
 
 MyWorkWindow::MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) :
     WorkWindow( pParent, nWinStyle )
 {
+    nPaintCount = 0;
+    nStartTime = getTimeNow();
     EnableInput();
 }
 
+void MyWorkWindow::Paint( const Rectangle& rRect )
+{
+    SAL_INFO("vcl.icontest", "==> Paint! " << nPaintCount++ << " (vcl) " << GetSizePixel() << " " << getTimeNow() - nStartTime);
+    WorkWindow::Paint( rRect );
+    Invalidate( INVALIDATE_CHILDREN );
+}
+
 MyOpenGLWorkWindow::MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) :
     MyWorkWindow( pParent, nWinStyle )
 {
@@ -176,7 +199,7 @@ void MyOpenGLWorkWindow::LoadTexture()
 
 void MyOpenGLWorkWindow::Paint( const Rectangle& )
 {
-    SAL_INFO("vcl.icontest", "==> Paint! (OpenGL) " << GetSizePixel());
+    SAL_INFO("vcl.icontest", "==> Paint! "<< nPaintCount++ << " (OpenGL) " << GetSizePixel() << " " << getTimeNow() - nStartTime);
     OpenGLContext& aCtx = mpOpenGLWindow->getContext();
     aCtx.requestLegacyContext();
     CHECK_GL_ERROR();
@@ -228,6 +251,8 @@ void MyOpenGLWorkWindow::Paint( const Rectangle& )
 
     aCtx.swapBuffers();
     CHECK_GL_ERROR();
+
+    Invalidate( INVALIDATE_CHILDREN );
 }
 
 void MyWorkWindow::Resize()


More information about the Libreoffice-commits mailing list