Kaydet (Commit) 4fd547e6 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add some silly looping and timing

Change-Id: Ibfb77e7d5fb32c317e773851536444679e5b65fa
üst 510c3586
...@@ -10,7 +10,8 @@ ...@@ -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; ...@@ -45,13 +46,27 @@ using namespace com::sun::star;
namespace { namespace {
const int WIDTH = 1000, HEIGHT = 800; 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 class MyWorkWindow : public WorkWindow
{ {
protected:
double nStartTime;
int nPaintCount;
public: public:
MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ); MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
}; };
...@@ -69,15 +84,23 @@ public: ...@@ -69,15 +84,23 @@ public:
MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle ); MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
}; };
MyWorkWindow::MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) : MyWorkWindow::MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) :
WorkWindow( pParent, nWinStyle ) WorkWindow( pParent, nWinStyle )
{ {
nPaintCount = 0;
nStartTime = getTimeNow();
EnableInput(); 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 ) : MyOpenGLWorkWindow::MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) :
MyWorkWindow( pParent, nWinStyle ) MyWorkWindow( pParent, nWinStyle )
{ {
...@@ -176,7 +199,7 @@ void MyOpenGLWorkWindow::LoadTexture() ...@@ -176,7 +199,7 @@ void MyOpenGLWorkWindow::LoadTexture()
void MyOpenGLWorkWindow::Paint( const Rectangle& ) 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(); OpenGLContext& aCtx = mpOpenGLWindow->getContext();
aCtx.requestLegacyContext(); aCtx.requestLegacyContext();
CHECK_GL_ERROR(); CHECK_GL_ERROR();
...@@ -228,6 +251,8 @@ void MyOpenGLWorkWindow::Paint( const Rectangle& ) ...@@ -228,6 +251,8 @@ void MyOpenGLWorkWindow::Paint( const Rectangle& )
aCtx.swapBuffers(); aCtx.swapBuffers();
CHECK_GL_ERROR(); CHECK_GL_ERROR();
Invalidate( INVALIDATE_CHILDREN );
} }
void MyWorkWindow::Resize() void MyWorkWindow::Resize()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment