X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fdebugscript.h;h=0625535db2532d6aa2412621172f73008919ec71;hp=8b62b5ccbba15c03c2f4b8a708582377bf8a79a1;hb=a8297c3461718f2d9afc7a2f8ca620d320ac5f97;hpb=b29310a04a51cd7d39d0858e2dec8a75c15cf097 diff --git a/src/debugscript.h b/src/debugscript.h index 8b62b5c..0625535 100644 --- a/src/debugscript.h +++ b/src/debugscript.h @@ -13,12 +13,9 @@ namespace IPDF class DebugScript { public: - DebugScript() : inp(), currentAction(), m_actions(), m_labels(), m_index(0) {} + DebugScript(std::istream * in) : m_input(in), currentAction(), m_actions(), m_labels(), m_index(0) {} virtual ~DebugScript() {} - void Load(const char *filename) - { - inp.open(filename); - } + bool Execute(View *view, Screen *scr); private: enum ActionType @@ -36,6 +33,18 @@ private: AT_Label, AT_Goto, AT_Debug, + AT_ClearDocument, + AT_ClearPerformance, + AT_PrintPerformance, + AT_RecordPerformance, + AT_DebugFont, + AT_ApproachBoundsZeno, + AT_ApproachBoundsLinear, + AT_SetBounds, + AT_QueryGPUBounds, // query bounds of Beziers when transformed to GPU + AT_ScreenShot, // take screenshot + AT_PrintFPS, // Print FPS statistics about the frames + AT_PrintBounds, // Print bounds AT_Quit }; @@ -47,17 +56,37 @@ private: Real z; int iz; int loops; + Real w, h; std::string textargs; Action() : type(AT_WaitFrame), x(0), y(0), ix(0), iy(0), z(0), loops(0), textargs("") {} }; - std::ifstream inp; + std::istream * m_input; Action currentAction; std::vector m_actions; std::map m_labels; unsigned m_index; - void ParseAction(); + + double m_fps_cpu_mean; + double m_fps_gpu_mean; + double m_fps_cpu_stddev; + double m_fps_gpu_stddev; + + struct PerformanceData + { + clock_t clock; + unsigned object_count; + VRect view_bounds; + }; + + PerformanceData m_perf_start; + PerformanceData m_perf_last; + + void PrintPerformance(View * view, Screen * scr); + void ClearPerformance(View * view, Screen * scr); + + void ParseAction(View * view, Screen * scr); }; }