1,295
edits
(→Paths) |
(→Paths) |
||
| Line 60: | Line 60: | ||
Paths are immutable once created (except you can overwrite one Path with another). In particular you can't add to a path after creating and using it; there's typically no need for that. You can however overwrite one Path value with another. Keeping Paths immutable should make serialization and caching (e.g. tesselation caching) simpler. | Paths are immutable once created (except you can overwrite one Path with another). In particular you can't add to a path after creating and using it; there's typically no need for that. You can however overwrite one Path value with another. Keeping Paths immutable should make serialization and caching (e.g. tesselation caching) simpler. | ||
Paths (conceptually) keep all their coordinates in user space because that's what we want when we retain paths, e.g. for SVG shapes. | ''Paths (conceptually) keep all their coordinates in user space because that's what we want when we retain paths, e.g. for SVG shapes.'' The cairo/canvas-2D feature where path points are transformed by the current matrix as they're added can and should be emulated at the nsCanvasRenderingContext2D layer. (Basically we'd emit the path in user space coordinates, but if we detect a matrix change we'd convert the current path to device space coordinates and maintain it in device space thereafter.) | ||
Paths can only be used with a DrawTarget using the same backend type. | Paths can only be used with a DrawTarget using the same backend type. | ||
| Line 69: | Line 69: | ||
BackendType Backend() { return mBackend; } | BackendType Backend() { return mBackend; } | ||
virtual ~Path() {} | virtual ~Path() {} | ||
// CopyTo uses placement new to set aDest to the right implementation class. | // CopyTo uses placement new to set aDest to the right implementation class. | ||
// Note that if the underlying mPrivatePtr data is refcounted, copying | // Note that if the underlying mPrivatePtr data is refcounted, copying | ||
| Line 75: | Line 75: | ||
virtual void CopyTo(Path* aDest) const { assert(false); } | virtual void CopyTo(Path* aDest) const { assert(false); } | ||
Path& operator=(const Path& aPath) { aPath.CopyTo(this); return *this; } | Path& operator=(const Path& aPath) { aPath.CopyTo(this); return *this; } | ||
virtual bool ContainsPoint(Point aPt) { assert(false); } | virtual bool ContainsPoint(Point aPt) { assert(false); } | ||
edits