diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-01-06 16:07:07 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-01-06 16:13:29 +0000 |
commit | bc6f2ee84dcb66be6a0867d34ce212a2df65efdf (patch) | |
tree | ba6b2c7a1aa29b43863bd7ec5a00c8469b6461eb /vcl/workben | |
parent | c075fc1b39c7d8389cd960ccde7295d011105ae6 (diff) |
vcldemo: extend threaded rendering test.
Change-Id: I81e31e1e7442fd0c6d8d720dbd0e9d5cb82bf52b
Diffstat (limited to 'vcl/workben')
-rw-r--r-- | vcl/workben/vcldemo.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index b4e5ed67c48d..608007d0dfeb 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -15,6 +15,7 @@ #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/ucb/UniversalContentBroker.hpp> +#include <osl/time.h> #include <vcl/vclmain.hxx> #include <vcl/layout.hxx> #include <salhelper/thread.hxx> @@ -1200,12 +1201,14 @@ class DemoWin : public WorkWindow bool testThreads; class RenderThread : public salhelper::Thread { - DemoWin &mrWin; + DemoWin &mrWin; + TimeValue maDelay; public: - RenderThread(DemoWin &rWin) + RenderThread(DemoWin &rWin, sal_uInt32 nDelaySecs) : Thread("vcldemo render thread") , mrWin(rWin) { + maDelay.Seconds = nDelaySecs; launch(); } virtual ~RenderThread() @@ -1214,6 +1217,8 @@ class DemoWin : public WorkWindow } virtual void execute() { + osl_waitThread(&maDelay); + SolarMutexGuard aGuard; fprintf (stderr, "render from a different thread\n"); mrWin.Paint(Rectangle()); @@ -1242,7 +1247,10 @@ public: { if (testThreads) { // render this window asynchronously in a new thread - mxThread = new RenderThread(*this); + sal_uInt32 nDelaySecs = 0; + if (rMEvt.GetButtons() & MOUSE_RIGHT) + nDelaySecs = 5; + mxThread = new RenderThread(*this, nDelaySecs); } else { // spawn another window @@ -1388,6 +1396,12 @@ public: bWidgets = true; else if (aArg == "--threads") bThreads = true; + else if (aArg.startsWith("--")) + { + fprintf(stderr,"Unknown argument '%s'\n", + rtl::OUStringToOString(aArg, RTL_TEXTENCODING_UTF8).getStr()); + return showHelp(aRenderer); + } } DemoWin aMainWin(aRenderer, bThreads); |