On Aug 23, 2010, at 4:33 AM, Maciej Stachowiak wrote:
- tx, ty are the origin of the parent's coordinate system relative to the origin for its layer. When a layer paints, it establishes a CTM such that its own origin is 0, 0 (I think).
They are relative to a painting root, which will basically either be the document or a compositing layer.
The more obvious way, given the variable names, would be to make x(), y() an IntPoint, with a name like originInParentCoordinates()
It already is an IntPoint internally. There's already a method to access it as a point.
IntPoint location() const
(hopefully less verbose, but you get the idea). tx, ty could be named parentOffsetFromLayerCoordinates or something. This seems to be the intent of the names - that x,y is a point and tx, ty is a translation. But this doesn't work in point/size logic. You repeatedly add x(), y() to tx, ty to get a new tx, ty. But that means you're adding a point to a size and expecting to get a new size - but that's not how it works.
I think a helper method that does the right thing solves this problem (rather than having to flip what x/y and tx/ty mean just to do some math operation).