From: David Gow Date: Thu, 25 Sep 2014 02:54:57 +0000 (+0800) Subject: Lazy + CPU/GPU rendering toggle in script. X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=875df16552ba91c5eb4a7aaf3c48537b3d93b3fb;p=ipdf%2Fcode.git Lazy + CPU/GPU rendering toggle in script. --- diff --git a/src/debugscript.cpp b/src/debugscript.cpp index b8746ed..a8bcd78 100644 --- a/src/debugscript.cpp +++ b/src/debugscript.cpp @@ -60,6 +60,26 @@ void DebugScript::ParseAction() currentAction.type = AT_ZoomPx; return; } + else if (actionType == "gpu") + { + currentAction.type = AT_SetGPURendering; + return; + } + else if (actionType == "cpu") + { + currentAction.type = AT_SetCPURendering; + return; + } + else if (actionType == "lazy") + { + currentAction.type = AT_EnableLazyRendering; + return; + } + else if (actionType == "nolazy") + { + currentAction.type = AT_DisableLazyRendering; + return; + } else if (actionType == "quit") { currentAction.type = AT_Quit; @@ -89,6 +109,18 @@ bool DebugScript::Execute(View *view, Screen *scr) case AT_ZoomPx: view->ScaleAroundPoint(Real(currentAction.ix)/Real(scr->ViewportWidth()),Real(currentAction.iy)/Real(scr->ViewportHeight()), Real(expf(-currentAction.iz/20.f))); break; + case AT_SetGPURendering: + view->SetGPURendering(true); + break; + case AT_SetCPURendering: + view->SetGPURendering(false); + break; + case AT_EnableLazyRendering: + view->SetLazyRendering(true); + break; + case AT_DisableLazyRendering: + view->SetLazyRendering(false); + break; default: Fatal("Unknown script command in queue."); } diff --git a/src/debugscript.h b/src/debugscript.h index 822819a..9e4dce8 100644 --- a/src/debugscript.h +++ b/src/debugscript.h @@ -26,6 +26,10 @@ private: AT_Zoom, AT_TranslatePx, AT_ZoomPx, + AT_SetCPURendering, + AT_SetGPURendering, + AT_EnableLazyRendering, + AT_DisableLazyRendering, AT_Quit }; diff --git a/src/test.script b/src/test.script index fecd5d7..302267a 100644 --- a/src/test.script +++ b/src/test.script @@ -1,6 +1,10 @@ # Test script for IPDF automation. -loop 1000 pxzoom 400 300 1 +gpu +nolazy +loop 50 pxzoom 400 300 1 translate 10.0 -3.0 loop 100 wait -loop 1000 zoom 0.5 0.5 0.95 +cpu +lazy +loop 90 zoom 0.5 0.5 1.05 quit