+
+ case AT_ApproachBoundsZeno:
+ {
+ VRect target(currentAction.x, currentAction.y, currentAction.w, currentAction.h);
+ if (currentAction.z != VReal(1))
+ {
+ target.x = view->GetBounds().x + (target.x-view->GetBounds().x)/VReal(currentAction.z);
+ target.y = view->GetBounds().y + (target.y-view->GetBounds().y)/VReal(currentAction.z);
+ target.w = view->GetBounds().w + (target.w-view->GetBounds().w)/VReal(currentAction.z);
+ target.h = view->GetBounds().h + (target.h-view->GetBounds().h)/VReal(currentAction.z);
+ }
+
+
+ VReal s = target.w/(view->GetBounds().w);
+ if (s != VReal(1))
+ {
+ VReal x0;
+ VReal y0;
+ x0 = (view->GetBounds().x - target.x)/((s - VReal(1))*view->GetBounds().w);
+ y0 = (view->GetBounds().y - target.y)/((s - VReal(1))*view->GetBounds().h);
+ view->ScaleAroundPoint(Double(x0), Double(y0), Double(s));
+ currentAction.loops++;
+ }
+ else
+ {
+ Debug("Already at target view; Waiting for remaining %d frames", currentAction.loops);
+ currentAction.type = AT_WaitFrame;
+ }
+ break;
+ }
+ case AT_ApproachBoundsLinear:
+ {
+ VRect target(currentAction.x, currentAction.y, currentAction.w, currentAction.h);
+ target.x += view->GetBounds().x;
+ target.y += view->GetBounds().y;
+ target.w += view->GetBounds().w;
+ target.h += view->GetBounds().h;
+ VReal s = target.w/(view->GetBounds().w);
+ if (s != VReal(1))
+ {
+ VReal x0;
+ VReal y0;
+ x0 = (view->GetBounds().x - target.x)/((s - VReal(1))*view->GetBounds().w);
+ y0 = (view->GetBounds().y - target.y)/((s - VReal(1))*view->GetBounds().h);
+ view->ScaleAroundPoint(Double(x0), Double(y0), Double(s));
+ currentAction.loops++;
+ }
+ else
+ {
+ Debug("Already at target view; Waiting for remaining %d frames", currentAction.loops);
+ currentAction.type = AT_WaitFrame;
+ }
+ break;
+ }
+ case AT_SetBounds:
+ {
+ VRect target(currentAction.x, currentAction.y, currentAction.w, currentAction.h);
+ view->SetBounds(target);
+ break;
+ }
+
+ case AT_QueryGPUBounds:
+ {
+ view->QueryGPUBounds(currentAction.textargs.c_str(), "w");
+ currentAction.loops = 1;
+ break;
+ }
+ case AT_ScreenShot:
+ {
+ view->SaveBMP(currentAction.textargs.c_str());
+ currentAction.loops = 1;
+ break;
+ }
+ case AT_PrintSPF:
+ {
+ // Using a (apparently) Soviet trick to calculate the stddev in one pass
+ // This was my favourite algorithm in my Physics honours project
+ // Ah the memories
+ // The horrible horrible memories
+ // At least things won't get that bad
+ // Right?
+ if (currentAction.loops <= 1)
+ {
+ double n = double(currentAction.iz);
+ m_spf_cpu_mean /= n;
+ m_spf_gpu_mean /= n;
+
+ m_spf_cpu_stddev = sqrt(m_spf_cpu_stddev / n - m_spf_cpu_mean*m_spf_cpu_mean);
+ m_spf_gpu_stddev = sqrt(m_spf_gpu_stddev / n - m_spf_gpu_mean*m_spf_gpu_mean);
+
+
+
+ printf("%d\t%f\t%f\t%f\t%f\n", currentAction.iz,
+ m_spf_gpu_mean, m_spf_gpu_stddev,
+ m_spf_cpu_mean, m_spf_cpu_stddev);
+ }
+ else
+ {
+
+ double spf_cpu = scr->GetLastFrameTimeCPU();
+ double spf_gpu = scr->GetLastFrameTimeGPU();
+
+ m_spf_cpu_mean += spf_cpu;
+ m_spf_gpu_mean += spf_gpu;
+
+ m_spf_cpu_stddev += spf_cpu*spf_cpu;
+ m_spf_gpu_stddev += spf_gpu*spf_gpu;
+ }
+ break;
+ }
+ case AT_PrintBounds:
+ {
+ printf("%s\t%s\t%s\t%s\t%s\t%s\n", Str(view->GetBounds().x).c_str(), Str(view->GetBounds().y).c_str(), Str(view->GetBounds().w).c_str(), Str(view->GetBounds().h).c_str(), Str(Log10(view->GetBounds().w)).c_str(), Str(Log10(view->GetBounds().h)).c_str());
+ break;
+ }
+ case AT_ProfileDisplay:
+ {
+ g_profiler.Enable(currentAction.iz);
+ break;
+ }