Hi All,
I'm a bit confused about the way that SPItemCtx is implemented. I have a few questions:
SPItemCtx is defined in src/sp-item.h as follows:
/// Contains transformations to document/viewport and the viewport size. class SPItemCtx { public: SPCtx ctx; /** Item to document transformation */ Geom::Affine i2doc; /** Viewport size */ Geom::Rect viewport; /** Item to viewport transformation */ Geom::Affine i2vp; };
As far as I can tell, the only place where an SPItemCtx object is created is in the SPDocument::_updateDocument() function. It is then cast to SPCtx object and sent to the updateDisplay function. Various "update" handlers then retrieve the SPItemCtx data by casting back:
SPItemCtx *ictx = (SPItemCtx *) ctx; double const aw = 1.0 / ictx->i2vp.descrim();
This seems a bit weird to me... why not make SPItemCtx a subclass of SPCtx? That way, we wouldn't need to do risky reinterpret_cast<> operations.
Any thoughts?
AV