summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-10-10 21:16:24 +0300
committerTor Lillqvist <tml@collabora.com>2014-10-10 21:19:14 +0300
commit4fd547e61ef97ca15fb5474044ee91cffda6e389 (patch)
treedc4edccfc6139eebff4ab9f53f5dddb411dc9027
parent510c3586460f234a5ba6f9da16eea0dd5768656c (diff)
Add some silly looping and timing
Change-Id: Ibfb77e7d5fb32c317e773851536444679e5b65fa
-rw-r--r--vcl/workben/icontest.cxx31
1 files changed, 28 insertions, 3 deletions
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 6e8bd7ebfe3f..10253c79dde3 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()