About to break everything with a merge
[ipdf/code.git] / src / debugscript.h
index 822819a..916425c 100644 (file)
@@ -13,10 +13,9 @@ namespace IPDF
 class DebugScript
 {
 public:
-       void Load(const char *filename)
-       {
-               inp.open(filename);
-       }
+       DebugScript(std::istream * in) : m_input(in), currentAction(), m_actions(), m_labels(), m_index(0) {}
+       virtual ~DebugScript() {}
+
        bool Execute(View *view, Screen *scr);
 private:
        enum ActionType
@@ -26,25 +25,68 @@ private:
                AT_Zoom,
                AT_TranslatePx,
                AT_ZoomPx,
+               AT_SetCPURendering,
+               AT_SetGPURendering,
+               AT_EnableLazyRendering,
+               AT_DisableLazyRendering,
+               AT_LoadSVG,
+               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_PrintSPF, // Print FPS statistics about the frames
+               AT_PrintBounds, // Print bounds
                AT_Quit
        };
 
        struct Action
        {
                ActionType type;
-               Real x, y;
+               VReal x, y;
                int ix, iy;
-               Real z;
+               VReal z;
                int iz;
                int loops;
-               Action() : type(AT_WaitFrame), x(0), y(0), ix(0), iy(0), z(0), loops(0) {}
+               VReal 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;
-
-       void ParseAction();
+       std::vector<Action> m_actions;
+       std::map<std::string, int> m_labels;
+       unsigned m_index;
+       
+       double m_spf_cpu_mean;
+       double m_spf_gpu_mean;
+       double m_spf_cpu_stddev;
+       double m_spf_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);
 };
 
 }

UCC git Repository :: git.ucc.asn.au