Real l = a*tl*tl*tl + b*tl*tl + c*tl + d;
Real u = a*tu*tu*tu + b*tu*tu + c*tu + d;
if ((l < 0 && u < 0) || (l > 0 && u > 0))
- Debug("Discarding segment (no roots) l = %f (%f), u = %f (%f)", tl, l, tu, u);
+ Debug("Discarding segment (no roots) l = %f (%f), u = %f (%f)", Double(tl), Double(l), Double(tu), Double(u));
//return;
bool negative = (u < l); // lower point > 0, upper point < 0
- Debug("%ft^3 + %ft^2 + %ft + %f is negative (%f < %f) %d", a,b,c,d,u,l, negative);
+ Debug("%ft^3 + %ft^2 + %ft + %f is negative (%f < %f) %d", Double(a),Double(b),Double(c),Double(d),Double(u),Double(l), negative);
while (tu - tl > delta)
{
Real t(tu+tl);
{
currentAction.type = AT_Quit;
}
+ else if (actionType == "loadsvg")
+ {
+ currentAction.type = AT_LoadSVG;
+ inp >> currentAction.filename;
+ }
}
bool DebugScript::Execute(View *view, Screen *scr)
case AT_DisableLazyRendering:
view->SetLazyRendering(false);
break;
+ case AT_LoadSVG:
+ #ifdef TRANSFORM_OBJECTS_NOT_VIEW
+ view->Doc().LoadSVG(currentAction.filename, Rect(Real(1)/Real(2),Real(1)/Real(2),Real(1)/Real(800),Real(1)/Real(600)));
+ #else
+ Rect & bounds = view->GetBounds();
+ view->Doc().LoadSVG(currentAction.filename, Rect(bounds.x+bounds.w/Real(2),bounds.y+bounds.h/Real(2),bounds.w/Real(800),bounds.h/Real(600)));
+ #endif
+ currentAction.type = AT_WaitFrame;
+ view->ForceRenderDirty();
+ view->ForceBufferDirty();
+ view->ForceBoundsDirty();
+ currentAction.loops = 0;
+ break;
default:
Fatal("Unknown script command in queue.");
}
AT_SetGPURendering,
AT_EnableLazyRendering,
AT_DisableLazyRendering,
+ AT_LoadSVG,
AT_Quit
};
Real z;
int iz;
int loops;
+ std::string filename;
Action() : type(AT_WaitFrame), x(0), y(0), ix(0), iy(0), z(0), loops(0) {}
};
if (!result)
Error("Couldn't load \"%s\" - %s", filename.c_str(), result.description());
- Debug("Loaded XML - %s", result.description());
+ Debug("Loaded XML from \"%s\" - %s", filename.c_str(), result.description());
input.close();
// a c e, b d f
ParanoidNumber::ParanoidNumber(const string & str) : m_value(0), m_next()
{
#ifdef PARANOID_SIZE_LIMIT
- m_size = 0;
+ m_size = 1;
#endif
#ifdef PARANOID_CACHE_RESULTS
m_cached_result = NAN;
m_cached_result = NAN;
#endif
#ifdef PARANOID_SIZE_LIMIT
- if (m_size >= PARANOID_SIZE_LIMIT)
+ if (m_size + b->m_size >= PARANOID_SIZE_LIMIT)
{
this->operator=(this->Digit());
if (op == ADD)
m_value += b->Digit();
else
m_value -= b->Digit();
- m_size = 0;
- Debug("Cut off %p", this);
+ m_size = 1;
+ //Debug("Cut off %p", this);
return b;
}
//Debug("At size limit %d", m_size);
//merge->m_next[*merge_op].push_back(b);
m_next[op].push_back(b);
#ifdef PARANOID_SIZE_LIMIT
- m_size += 1+b->m_size;
+ m_size += b->m_size;
#endif
}
else
m_cached_result = NAN;
#endif
#ifdef PARANOID_SIZE_LIMIT
- if (m_size >= PARANOID_SIZE_LIMIT)
+ if (m_size + b->m_size >= PARANOID_SIZE_LIMIT)
{
this->operator=(this->Digit());
if (op == MULTIPLY)
m_value *= b->Digit();
else
m_value /= b->Digit();
- m_size = 0;
+ m_size = 1;
- Debug("Cut off %p", this);
+ //Debug("Cut off %p", this);
return b;
}
delete(sub->OperationFactor(new ParanoidNumber(*cpy_b), op));
#ifdef PARANOID_SIZE_LIMIT
- m_size += 1+b->m_size;
+ m_size += b->m_size;
#endif
}
//assert(SanityCheck());
if (result != NULL)
{
#ifdef PARANOID_SIZE_LIMIT
- m_size -= (1+result->m_size);
+ m_size -= result->m_size;
#endif
*m = NULL;
delete(result);
#ifdef PARANOID_SIZE_LIMIT
if (Operation(n, op) == n)
{
- m_size -= (1+n->m_size);
+ m_size -= n->m_size;
delete n;
}
#else
ParanoidNumber(PARANOID_DIGIT_T value=0) : m_value(value), m_next()
{
#ifdef PARANOID_SIZE_LIMIT
- m_size = 0;
+ m_size = 1;
#endif
#ifdef PARANOID_CACHE_RESULTS
m_cached_result = value;
inline Real RealFromStr(const std::string & str) {return RealFromStr(str.c_str());}
- inline void DebugRealInfo() {Debug("Compiled with REAL = %d => \"%s\" sizeof(Real) == %d bytes", REALTYPE, g_real_name[REALTYPE], sizeof(Real));}
+ inline void DebugRealInfo()
+ {
+ Debug("Compiled with REAL = %d => \"%s\" sizeof(Real) == %d bytes", REALTYPE, g_real_name[REALTYPE], sizeof(Real));
+ #if REALTYPE == REAL_PARANOIDNUMBER
+ #ifdef PARANOID_SIZE_LIMIT
+ Debug("Size limit of %d is being enforced", PARANOID_SIZE_LIMIT);
+ #endif
+ #endif
+ }
}
# Test script for IPDF automation.
+# loadsvg svg-tests/rabbit_simple.svg
gpu
nolazy
loop 50 pxzoom 400 300 1
cpu
lazy
loop 90 zoom 0.5 0.5 1.05
-quit
+loadsvg svg-tests/rabbit_simple.svg
+wait
void SaveCPUBMP(const char * filename);
void SaveGPUBMP(const char * filename);
+ Document & Doc() {return m_document;}
+
private:
struct GPUObjBounds
{