Esempio n. 1
0
// constructor
Shape::Shape(const Shape& other)
#ifdef ICON_O_MATIC
	: IconObject(other),
	  Transformable(other),
	  Observer(),
	  PathContainerListener(),
#else
	: Transformable(other),
#endif

	  fPaths(new (nothrow) PathContainer(false)),
	  fStyle(NULL),

	  fPathSource(fPaths),
	  fTransformers(4),
	  fNeedsUpdate(true),

	  fLastBounds(0, 0, -1, -1),

	  fHinting(other.fHinting),
	  fMinVisibilityScale(other.fMinVisibilityScale),
	  fMaxVisibilityScale(other.fMaxVisibilityScale)

#ifdef ICON_O_MATIC
	, fListeners(8)
#endif
{
	SetStyle(other.fStyle);

	if (fPaths) {
#ifdef ICON_O_MATIC
		fPaths->AddListener(this);
#endif
		// copy the path references from
		// the other shape
		if (other.fPaths) {
			int32 count = other.fPaths->CountPaths();
			for (int32 i = 0; i < count; i++) {
				if (!fPaths->AddPath(other.fPaths->PathAtFast(i)))
					break;
			}
		}
	}
	// clone vertex transformers
	int32 count = other.CountTransformers();
	for (int32 i = 0; i < count; i++) {
		Transformer* original = other.TransformerAtFast(i);
		Transformer* cloned = original->Clone(fPathSource);
		if (!AddTransformer(cloned)) {
			delete cloned;
			break;
		}
	}
}