Эх сурвалжийг харах

[cpp] Removed toString, fixed up remaining memory leaks in clipping and animation state code.

badlogic 7 жил өмнө
parent
commit
9ceec41432
79 өөрчлөгдсөн 98 нэмэгдсэн , 359 устгасан
  1. 1 1
      spine-cpp/spine-cpp/include/spine/Animation.h
  2. 3 5
      spine-cpp/spine-cpp/include/spine/AnimationState.h
  3. 2 2
      spine-cpp/spine-cpp/include/spine/AnimationStateData.h
  4. 1 16
      spine-cpp/spine-cpp/include/spine/Atlas.h
  5. 1 1
      spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h
  6. 1 1
      spine-cpp/spine-cpp/include/spine/Bone.h
  7. 1 1
      spine-cpp/spine-cpp/include/spine/BoneData.h
  8. 1 1
      spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h
  9. 1 1
      spine-cpp/spine-cpp/include/spine/ClippingAttachment.h
  10. 0 7
      spine-cpp/spine-cpp/include/spine/Color.h
  11. 3 0
      spine-cpp/spine-cpp/include/spine/Debug.h
  12. 1 1
      spine-cpp/spine-cpp/include/spine/Event.h
  13. 1 1
      spine-cpp/spine-cpp/include/spine/EventData.h
  14. 0 22
      spine-cpp/spine-cpp/include/spine/HashMap.h
  15. 1 1
      spine-cpp/spine-cpp/include/spine/IkConstraint.h
  16. 1 1
      spine-cpp/spine-cpp/include/spine/IkConstraintData.h
  17. 1 1
      spine-cpp/spine-cpp/include/spine/Json.h
  18. 1 1
      spine-cpp/spine-cpp/include/spine/LinkedMesh.h
  19. 1 1
      spine-cpp/spine-cpp/include/spine/MeshAttachment.h
  20. 1 1
      spine-cpp/spine-cpp/include/spine/PathAttachment.h
  21. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraint.h
  22. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraintData.h
  23. 1 1
      spine-cpp/spine-cpp/include/spine/PointAttachment.h
  24. 0 6
      spine-cpp/spine-cpp/include/spine/Pool.h
  25. 1 1
      spine-cpp/spine-cpp/include/spine/RTTI.h
  26. 1 1
      spine-cpp/spine-cpp/include/spine/RegionAttachment.h
  27. 1 1
      spine-cpp/spine-cpp/include/spine/Skeleton.h
  28. 1 3
      spine-cpp/spine-cpp/include/spine/SkeletonBinary.h
  29. 2 2
      spine-cpp/spine-cpp/include/spine/SkeletonBounds.h
  30. 2 2
      spine-cpp/spine-cpp/include/spine/SkeletonClipping.h
  31. 1 1
      spine-cpp/spine-cpp/include/spine/SkeletonData.h
  32. 1 1
      spine-cpp/spine-cpp/include/spine/SkeletonJson.h
  33. 2 2
      spine-cpp/spine-cpp/include/spine/Skin.h
  34. 1 1
      spine-cpp/spine-cpp/include/spine/Slot.h
  35. 1 1
      spine-cpp/spine-cpp/include/spine/SlotData.h
  36. 0 2
      spine-cpp/spine-cpp/include/spine/SpineObject.h
  37. 1 15
      spine-cpp/spine-cpp/include/spine/String.h
  38. 0 2
      spine-cpp/spine-cpp/include/spine/Timeline.h
  39. 1 1
      spine-cpp/spine-cpp/include/spine/TransformConstraint.h
  40. 1 1
      spine-cpp/spine-cpp/include/spine/TransformConstraintData.h
  41. 8 12
      spine-cpp/spine-cpp/include/spine/Triangulator.h
  42. 0 12
      spine-cpp/spine-cpp/include/spine/Vector.h
  43. 0 4
      spine-cpp/spine-cpp/include/spine/Vertices.h
  44. 0 8
      spine-cpp/spine-cpp/src/spine/Animation.cpp
  45. 18 15
      spine-cpp/spine-cpp/src/spine/AnimationState.cpp
  46. 0 10
      spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp
  47. 0 3
      spine-cpp/spine-cpp/src/spine/Atlas.cpp
  48. 0 3
      spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp
  49. 0 7
      spine-cpp/spine-cpp/src/spine/Bone.cpp
  50. 0 3
      spine-cpp/spine-cpp/src/spine/BoneData.cpp
  51. 0 8
      spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp
  52. 0 8
      spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp
  53. 0 3
      spine-cpp/spine-cpp/src/spine/Event.cpp
  54. 0 3
      spine-cpp/spine-cpp/src/spine/EventData.cpp
  55. 0 6
      spine-cpp/spine-cpp/src/spine/IkConstraint.cpp
  56. 0 3
      spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp
  57. 0 3
      spine-cpp/spine-cpp/src/spine/Json.cpp
  58. 0 3
      spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp
  59. 0 5
      spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp
  60. 0 8
      spine-cpp/spine-cpp/src/spine/PathAttachment.cpp
  61. 0 5
      spine-cpp/spine-cpp/src/spine/PathConstraint.cpp
  62. 0 5
      spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp
  63. 0 5
      spine-cpp/spine-cpp/src/spine/PointAttachment.cpp
  64. 0 5
      spine-cpp/spine-cpp/src/spine/RTTI.cpp
  65. 0 6
      spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp
  66. 0 12
      spine-cpp/spine-cpp/src/spine/Skeleton.cpp
  67. 0 4
      spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp
  68. 0 9
      spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp
  69. 8 13
      spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp
  70. 0 4
      spine-cpp/spine-cpp/src/spine/SkeletonData.cpp
  71. 0 4
      spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp
  72. 0 14
      spine-cpp/spine-cpp/src/spine/Skin.cpp
  73. 0 8
      spine-cpp/spine-cpp/src/spine/Slot.cpp
  74. 0 3
      spine-cpp/spine-cpp/src/spine/SlotData.cpp
  75. 0 5
      spine-cpp/spine-cpp/src/spine/Timeline.cpp
  76. 0 6
      spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp
  77. 0 3
      spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp
  78. 8 5
      spine-cpp/spine-cpp/src/spine/Triangulator.cpp
  79. 13 4
      spine-sfml/cpp/example/main.cpp

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Animation.h

@@ -101,7 +101,7 @@ public:
 
 	void setDuration(float inValue);
 
-	String toString() const;
+
 
 private:
 	Vector<Timeline *> _timelines;

+ 3 - 5
spine-cpp/spine-cpp/include/spine/AnimationState.h

@@ -214,7 +214,7 @@ namespace Spine {
         
         void setOnAnimationEventFunc(OnAnimationEventFunc inValue);
 
-        String toString() const;
+
     private:
         Animation* _animation;
         
@@ -251,7 +251,7 @@ namespace Spine {
         
         EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL);
 
-		String toString() const;
+
     };
     
     class EventQueue : public SpineObject {
@@ -285,8 +285,6 @@ namespace Spine {
 
         /// Raises all events in the queue and drains the queue.
         void drain();
-
-		String toString() const ;
     };
     
     class AnimationState : public SpineObject {
@@ -379,7 +377,7 @@ namespace Spine {
         void setRendererObject(void* inValue);
         void* getRendererObject();
 
-        String toString() const;
+
         
     private:
         static const int Subsequent, First, Dip, DipMix;

+ 2 - 2
spine-cpp/spine-cpp/include/spine/AnimationStateData.h

@@ -68,7 +68,7 @@ namespace Spine {
         ///
         float getMix(Animation* from, Animation* to);
 
-        String toString() const;
+
 
     private:
         class AnimationPair : public SpineObject {
@@ -80,7 +80,7 @@ namespace Spine {
             
             bool operator==(const AnimationPair &other) const;
 
-            String toString() const;
+
         };
         
         struct HashAnimationPair : public SpineObject {

+ 1 - 16
spine-cpp/spine-cpp/include/spine/Atlas.h

@@ -78,15 +78,6 @@ public:
 											   magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
 											   vWrap(TextureWrap_ClampToEdge) {
 	}
-
-	String toString() const {
-		String str;
-		str.append("AtlasPage { name: ").appendString(name)
-				.append(", width: ").append(width)
-				.append(", height: ").append(height)
-				.append(" }");
-		return str;
-	}
 };
 
 class AtlasRegion : public SpineObject {
@@ -101,12 +92,6 @@ public:
 	bool rotate;
 	Vector<int> splits;
 	Vector<int> pads;
-
-	String toString() const {
-		String str;
-		str.append("AtlasRegion { name: ").appendString(name).append(" }");
-		return str;
-	}
 };
 
 class TextureLoader;
@@ -128,7 +113,7 @@ public:
 
 	void dispose();
 
-	String toString() const;
+
 
 private:
 	Vector<AtlasPage *> _pages;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h

@@ -64,7 +64,7 @@ namespace Spine {
         
         AtlasRegion* findRegion(const String& name);
 
-        String toString() const;
+
         
     private:
         Atlas* _atlas;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Bone.h

@@ -221,7 +221,7 @@ public:
 	/// Returns the magnitide (always positive) of the world scale Y.
 	float getWorldScaleY();
 
-	String toString() const;
+
 
 private:
 	static bool yDown;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/BoneData.h

@@ -107,7 +107,7 @@ public:
 
 	void setTransformMode(TransformMode inValue);
 
-	String toString() const;
+
 
 private:
 	const int _index;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h

@@ -41,7 +41,7 @@ namespace Spine {
         
         explicit BoundingBoxAttachment(const String& name);
 
-        String toString() const;
+
     };
 }
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/ClippingAttachment.h

@@ -50,7 +50,7 @@ namespace Spine {
         SlotData* getEndSlot();
         void setEndSlot(SlotData* inValue);
 
-        String toString() const;
+
         
     private:
         SlotData* _endSlot;

+ 0 - 7
spine-cpp/spine-cpp/include/spine/Color.h

@@ -87,13 +87,6 @@ public:
 	}
 
 	float _r, _g, _b, _a;
-
-	inline String toString() const {
-		String str;
-		str.append("Color { r: ").append(_r).append(", g: ").append(_g).append(", b: ").append(_b).append(
-				", a: ").append(_a).append(" }");
-		return str;
-	}
 };
 }
 

+ 3 - 0
spine-cpp/spine-cpp/include/spine/Debug.h

@@ -51,6 +51,9 @@ class DebugExtension : public DefaultSpineExtension {
 	};
 
 public:
+	DebugExtension(): _allocations(0), _reallocations(0), _frees(0) {
+	}
+
 	void reportLeaks() {
 		for (std::vector<Allocation>::iterator it = _allocated.begin(); it != _allocated.end(); it++) {
 			printf("\"%s:%i (%zu bytes at %p)\n", it->fileName, it->line, it->size, it->address);

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Event.h

@@ -65,7 +65,7 @@ public:
 
 	void setStringValue(const String &inValue);
 
-	String toString() const;
+
 
 private:
 	const EventData &_data;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/EventData.h

@@ -61,7 +61,7 @@ public:
 
 	void setStringValue(const String &inValue);
 
-	String toString() const;
+
 
 private:
 	const String _name;

+ 0 - 22
spine-cpp/spine-cpp/include/spine/HashMap.h

@@ -150,22 +150,6 @@ public:
 		return Entries(_head);
 	}
 
-	String toString() const {
-		String str;
-
-		str.append("{");
-		Entries entries = getEntries();
-
-		while (entries.hasNext()) {
-			Pair pair = entries.next();
-			str.append(pair.key);
-			str.append("->");
-			str.append(pair.value);
-		}
-		str.append("}");
-		return str;
-	}
-
 private:
 	Entry *find(const K &key) {
 		for (Entry *entry = _head; entry != NULL; entry = entry->next) {
@@ -183,12 +167,6 @@ private:
 		Entry *prev;
 
 		Entry() : next(NULL), prev(NULL) {}
-
-		String toString() const {
-			String str;
-			str.append("Entry { key: ").append(_key).append(" -> ").append(_value);
-			return str;
-		}
 	};
 
 	Entry *_head;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/IkConstraint.h

@@ -84,7 +84,7 @@ public:
 
 	void setMix(float inValue);
 
-	String toString() const;
+
 
 private:
 	IkConstraintData &_data;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/IkConstraintData.h

@@ -68,7 +68,7 @@ namespace Spine {
         float getMix();
         void setMix(float inValue);
 
-        String toString() const;
+
 
     private:
         const String _name;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Json.h

@@ -69,7 +69,7 @@ public:
 
 	~Json();
 
-	String toString() const;
+
 
 private:
 	static const char *_error;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/LinkedMesh.h

@@ -45,7 +45,7 @@ class LinkedMesh : public SpineObject {
 public:
 	LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent);
 
-	String toString() const;
+
 
 private:
 	MeshAttachment *_mesh;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/MeshAttachment.h

@@ -122,7 +122,7 @@ namespace Spine {
         float getHeight();
         void setHeight(float inValue);
 
-        String toString() const;
+
 
     private:
         float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathAttachment.h

@@ -51,7 +51,7 @@ namespace Spine {
         bool isConstantSpeed();
         void setConstantSpeed(bool inValue);
 
-        String toString() const;
+
         
     private:
         Vector<float> _lengths;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraint.h

@@ -79,7 +79,7 @@ namespace Spine {
         
         PathConstraintData& getData();
 
-        String toString() const;
+
         
     private:
         static const float EPSILON;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintData.h

@@ -89,7 +89,7 @@ namespace Spine {
         float getTranslateMix();
         void setTranslateMix(float inValue);
 
-        String toString() const;
+
     private:
         const String _name;
         int _order;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PointAttachment.h

@@ -65,7 +65,7 @@ namespace Spine {
         float getRotation();
         void setRotation(float inValue);
 
-        String toString() const;
+
         
     private:
         float _x, _y, _rotation;

+ 0 - 6
spine-cpp/spine-cpp/include/spine/Pool.h

@@ -67,12 +67,6 @@ public:
 		}
 	}
 
-	String toString() const {
-		String str;
-		str.append("Pool { size: ").append((int) _objects.size()).append(" }");
-		return str;
-	}
-
 private:
 	Vector<T *> _objects;
 };

+ 1 - 1
spine-cpp/spine-cpp/include/spine/RTTI.h

@@ -48,7 +48,7 @@ public:
 
 	bool instanceOf(const RTTI &rtti) const;
 
-	String toString() const;
+
 
 private:
 	// Prevent copying

+ 1 - 1
spine-cpp/spine-cpp/include/spine/RegionAttachment.h

@@ -107,7 +107,7 @@ namespace Spine {
         Vector<float>& getOffset();
         Vector<float>& getUVs();
 
-        String toString() const;
+
         
     private:
         static const int BLX;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Skeleton.h

@@ -212,7 +212,7 @@ public:
 
 	void setFlipY(bool inValue);
 
-	String toString() const;
+
 
 private:
 	SkeletonData *_data;

+ 1 - 3
spine-cpp/spine-cpp/include/spine/SkeletonBinary.h

@@ -81,14 +81,12 @@ namespace Spine {
 
         String& getError() { return _error; }
 
-        String toString() const;
+
         
     private:
         struct DataInput : public SpineObject {
             const unsigned char* cursor;
             const unsigned char* end;
-
-            String toString() const { return String("DataInput"); }
         };
         
         AttachmentLoader* _attachmentLoader;

+ 2 - 2
spine-cpp/spine-cpp/include/spine/SkeletonBounds.h

@@ -86,7 +86,7 @@ namespace Spine {
         float getWidth();
         float getHeight();
 
-        String toString() const;
+
         
     private:
         Vector<Polygon*> _polygonPool;
@@ -106,7 +106,7 @@ namespace Spine {
 			_vertices.ensureCapacity(16);
         }
 
-        String toString() const;
+
     };
 }
 

+ 2 - 2
spine-cpp/spine-cpp/include/spine/SkeletonClipping.h

@@ -56,7 +56,7 @@ namespace Spine {
         Vector<unsigned short>& getClippedTriangles();
         Vector<float>& getClippedUVs();
 
-        String toString() const;
+
         
     private:
         Triangulator _triangulator;
@@ -67,7 +67,7 @@ namespace Spine {
         Vector<float> _clippedUVs;
         Vector<float> _scratch;
         ClippingAttachment* _clipAttachment;
-        Vector< Vector<float>* > _clippingPolygons;
+        Vector< Vector<float>* > *_clippingPolygons;
         
         /** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
                   * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SkeletonData.h

@@ -167,7 +167,7 @@ public:
 
 	void setFps(float inValue);
 
-	String toString() const;
+
 
 private:
 	String _name;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SkeletonJson.h

@@ -70,7 +70,7 @@ public:
 
 	String &getError() { return _error; }
 
-	String toString() const;
+
 
 private:
 	AttachmentLoader *_attachmentLoader;

+ 2 - 2
spine-cpp/spine-cpp/include/spine/Skin.h

@@ -61,7 +61,7 @@ public:
 
 		bool operator==(const AttachmentKey &other) const;
 
-		String toString() const;
+
 	};
 
 	struct HashAttachmentKey : public SpineObject {
@@ -93,7 +93,7 @@ public:
 
 	HashMap<AttachmentKey, Attachment *> &getAttachments();
 
-	String toString() const;
+
 
 private:
 	const String _name;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Slot.h

@@ -115,7 +115,7 @@ public:
 
 	void setAttachmentVertices(Vector<float> &inValue);
 
-	String toString() const;
+
 
 private:
 	SlotData &_data;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SlotData.h

@@ -98,7 +98,7 @@ public:
 
 	void setBlendMode(BlendMode inValue);
 
-	String toString() const;
+
 
 private:
 	const int _index;

+ 0 - 2
spine-cpp/spine-cpp/include/spine/SpineObject.h

@@ -45,8 +45,6 @@ public:
 	void operator delete(void *p);
 
 	virtual ~SpineObject();
-
-	virtual String toString() const = 0;
 };
 }
 

+ 1 - 15
spine-cpp/spine-cpp/include/spine/String.h

@@ -149,7 +149,7 @@ public:
 		return *this;
 	}
 
-	String &appendString(const String &other) {
+	String &append(const String &other) {
 		size_t len = other.length();
 		size_t thisLen = _length;
 		_length = _length + len;
@@ -173,16 +173,6 @@ public:
 		return *this;
 	}
 
-	String &append(const SpineObject &object) {
-		appendString(object.toString());
-		return *this;
-	}
-
-	String &append(const SpineObject *object) {
-		appendString(object->toString());
-		return *this;
-	}
-
 	friend bool operator==(const String &a, const String &b) {
 		if (a._buffer == b._buffer) return true;
 		if (a._length != b._length) return false;
@@ -203,10 +193,6 @@ public:
 		}
 	}
 
-	String toString() const {
-		return *this;
-	}
-
 private:
 	mutable size_t _length;
 	mutable char *_buffer;

+ 0 - 2
spine-cpp/spine-cpp/include/spine/Timeline.h

@@ -66,8 +66,6 @@ public:
 		  MixDirection direction) = 0;
 
 	virtual int getPropertyId() = 0;
-
-	virtual String toString() const;
 };
 }
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/TransformConstraint.h

@@ -74,7 +74,7 @@ namespace Spine {
         float getShearMix();
         void setShearMix(float inValue);
 
-        String toString() const;
+
         
     private:
         TransformConstraintData& _data;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/TransformConstraintData.h

@@ -68,7 +68,7 @@ namespace Spine {
         bool isRelative();
         bool isLocal();
 
-        String toString() const;
+
         
     private:
         const String _name;

+ 8 - 12
spine-cpp/spine-cpp/include/spine/Triangulator.h

@@ -37,28 +37,24 @@
 namespace Spine {
 class Triangulator : public SpineObject {
 public:
+	~Triangulator();
+
 	Vector<int> &triangulate(Vector<float> &vertices);
 
-	Vector<Vector < float>* >
-	decompose(Vector<float>
-	& vertices,
-	Vector<int> &triangles
-	);
+	Vector< Vector<float>* > &decompose(Vector<float> &vertices, Vector<int> &triangles);
+
 
-	String toString() const;
 
 private:
-	Vector<Vector < float>* >
-	_convexPolygons;
-	Vector<Vector < int>* >
-	_convexPolygonsIndices;
+	Vector<Vector < float>* > _convexPolygons;
+	Vector<Vector < int>* > _convexPolygonsIndices;
 
 	Vector<int> _indices;
 	Vector<bool> _isConcaveArray;
 	Vector<int> _triangles;
 
-	Pool <Vector<float>> _polygonPool;
-	Pool <Vector<int>> _polygonIndicesPool;
+	Pool <Vector<float> > _polygonPool;
+	Pool <Vector<int> > _polygonIndicesPool;
 
 	static bool isConcave(int index, int vertexCount, Vector<float> &vertices, Vector<int> &indices);
 

+ 0 - 12
spine-cpp/spine-cpp/include/spine/Vector.h

@@ -196,18 +196,6 @@ public:
 		return _buffer;
 	}
 
-	String toString() const {
-		String str;
-		str.append("Vector { size: ").append((int) _size).append(", items: [\n");
-		for (size_t i = 0; i < _size; i++) {
-			str.append("   ").append(_buffer[i]);
-			if (i != _size - 1) str.append(",\n");
-			else str.append("\n");
-		}
-		str.append("] }");
-		return str;
-	}
-
 private:
 	size_t _size;
 	size_t _capacity;

+ 0 - 4
spine-cpp/spine-cpp/include/spine/Vertices.h

@@ -38,10 +38,6 @@ class Vertices : public SpineObject {
 public:
 	Vector<int> _bones;
 	Vector<float> _vertices;
-
-	String toString() const {
-		return String("Vertices");
-	};
 };
 }
 

+ 0 - 8
spine-cpp/spine-cpp/src/spine/Animation.cpp

@@ -140,12 +140,4 @@ int Animation::linearSearch(Vector<float> &values, float target, int step) {
 
 	return -1;
 }
-
-String Animation::toString() const {
-	String str;
-	str.append("Animation { name: ").appendString(_name).append(", duration: ").append(_duration);
-	str.append(",\n timelines: ").appendString(_timelines.toString());
-	str.append("}");
-	return str;
-}
 }

+ 18 - 15
spine-cpp/spine-cpp/src/spine/AnimationState.cpp

@@ -212,20 +212,12 @@ void TrackEntry::reset() {
 	_onAnimationEventFunc = dummyOnAnimationEventFunc;
 }
 
-String TrackEntry::toString() const {
-	return String("TrackEntry");
-}
-
 EventQueueEntry::EventQueueEntry(EventType eventType, TrackEntry *trackEntry, Event *event) :
 		_type(eventType),
 		_entry(trackEntry),
 		_event(event) {
 }
 
-String EventQueueEntry::toString() const {
-	return String("EventQueueEntry");
-}
-
 EventQueue *EventQueue::newEventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool) {
 	return new(__FILE__, __LINE__) EventQueue(state, trackEntryPool);
 }
@@ -311,10 +303,6 @@ void EventQueue::drain() {
 	_drainDisabled = false;
 }
 
-String EventQueue::toString() const {
-	return String("EventQueue");
-}
-
 const int AnimationState::Subsequent = 0;
 const int AnimationState::First = 1;
 const int AnimationState::Dip = 2;
@@ -330,6 +318,24 @@ AnimationState::AnimationState(AnimationStateData *data) :
 }
 
 AnimationState::~AnimationState() {
+	for (int i = 0; i < _tracks.size(); i++) {
+		TrackEntry* entry = _tracks[i];
+		if (entry) {
+			TrackEntry* from = entry->_mixingFrom;
+			while (from) {
+				TrackEntry* curr = from;
+				from = curr->_mixingFrom;
+				delete curr;
+			}
+			TrackEntry* next = entry->_next;
+			while (next) {
+				TrackEntry* curr = next;
+				next = curr->_next;
+				delete curr;
+			}
+			delete entry;
+		}
+	}
 	delete _queue;
 }
 
@@ -975,7 +981,4 @@ void AnimationState::animationsChanged() {
 	}
 }
 
-String AnimationState::toString() const {
-	return String("AnimationState");
-}
 }

+ 0 - 10
spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp

@@ -74,10 +74,6 @@ void AnimationStateData::setDefaultMix(float inValue) {
 	_defaultMix = inValue;
 }
 
-String AnimationStateData::toString() const {
-	return String("AnimationStateData");
-}
-
 AnimationStateData::AnimationPair::AnimationPair(Animation *a1, Animation *a2) : _a1(a1), _a2(a2) {
 }
 
@@ -85,12 +81,6 @@ bool AnimationStateData::AnimationPair::operator==(const AnimationPair &other) c
 	return _a1->_name == other._a1->_name && _a2->_name == other._a2->_name;
 }
 
-String AnimationStateData::AnimationPair::toString() const {
-	String str;
-	str.append("AnimationPair { ").append(_a1->_name).append(" -> ").append(_a2->_name).append(" } ");
-	return str;
-}
-
 std::size_t
 AnimationStateData::HashAnimationPair::operator()(const Spine::AnimationStateData::AnimationPair &val) const {
 	std::size_t h1 = 7;

+ 0 - 3
spine-cpp/spine-cpp/src/spine/Atlas.cpp

@@ -349,7 +349,4 @@ int Atlas::toInt(Str *str) {
 	return (int) strtol(str->begin, (char **) &str->end, 10);
 }
 
-String Atlas::toString() const {
-	return String("Atlas");
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp

@@ -112,7 +112,4 @@ AtlasRegion *AtlasAttachmentLoader::findRegion(const String &name) {
 	return _atlas->findRegion(name);
 }
 
-String AtlasAttachmentLoader::toString() const {
-	return String("AtlasAttachmentLoader");
-}
 }

+ 0 - 7
spine-cpp/spine-cpp/src/spine/Bone.cpp

@@ -545,11 +545,4 @@ void Bone::updateAppliedTransform() {
 	}
 }
 
-String Bone::toString() const {
-	String str;
-	str.append("Bone { name: ").appendString(_data.getName());
-	str.append(", a: ").append(_a).append(", b: ").append(_b).append(", c").append(_c).append(", d: ").append(_d);
-	str.append(", worldX: ").append(_worldX).append(", worldY: ").append(_worldY).append(" }");
-	return str;
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/BoneData.cpp

@@ -134,7 +134,4 @@ void BoneData::setTransformMode(TransformMode inValue) {
 	_transformMode = inValue;
 }
 
-String BoneData::toString() const {
-	return String("BoneData");
-}
 }

+ 0 - 8
spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp

@@ -35,12 +35,4 @@ RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
 
 BoundingBoxAttachment::BoundingBoxAttachment(const String &name) : VertexAttachment(name) {
 }
-
-String BoundingBoxAttachment::toString() const {
-	String str;
-	str.append("BoundingBoxAttachment { name: ").appendString(getName()).append(", worldVerticesLength: ").append(
-			_worldVerticesLength);
-	str.append(",\n bones: ").append(_bones).append(",\n weights: ").append(_vertices).append(" }");
-	return str;
-}
 }

+ 0 - 8
spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp

@@ -45,12 +45,4 @@ SlotData *ClippingAttachment::getEndSlot() {
 void ClippingAttachment::setEndSlot(SlotData *inValue) {
 	_endSlot = inValue;
 }
-
-String ClippingAttachment::toString() const {
-	String str;
-	str.append("Clipping { name: ").appendString(getName());
-	str.append(", worldVerticesLength: ").append(_worldVerticesLength);
-	str.append(", bones: ").append(_bones).append(", weights: ").append(_vertices).append(" }");
-	return str;
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/Event.cpp

@@ -73,7 +73,4 @@ void Event::setStringValue(const String &inValue) {
 	_stringValue = inValue;
 }
 
-String Event::toString() const {
-	return String("Event");
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/EventData.cpp

@@ -70,7 +70,4 @@ void EventData::setStringValue(const String &inValue) {
 	_stringValue = inValue;
 }
 
-String EventData::toString() const {
-	return String("EventData");
-}
 }

+ 0 - 6
spine-cpp/spine-cpp/src/spine/IkConstraint.cpp

@@ -258,10 +258,4 @@ void IkConstraint::setMix(float inValue) {
 	_mix = inValue;
 }
 
-String IkConstraint::toString() const {
-	String str;
-	str.append("IkConstraint { name: ").appendString(_data.getName());
-	str.append("}");
-	return str;
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp

@@ -81,7 +81,4 @@ void IkConstraintData::setMix(float inValue) {
 	_mix = inValue;
 }
 
-String IkConstraintData::toString() const {
-	return String("IkConstraintData");
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/Json.cpp

@@ -538,7 +538,4 @@ int Json::json_strcasecmp(const char *s1, const char *s2) {
 	}
 }
 
-String Json::toString() const {
-	return String("Json");
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp

@@ -40,7 +40,4 @@ LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex,
 		_parent(parent) {
 }
 
-String LinkedMesh::toString() const {
-	return String("LinkedMesh");
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp

@@ -272,9 +272,4 @@ Spine::Color &MeshAttachment::getColor() {
 	return _color;
 }
 
-String MeshAttachment::toString() const {
-	String str;
-	str.append("RegionAttachment { name: ").appendString(getName()).append(", path: ").appendString(_path).append(" }");
-	return str;
-}
 }

+ 0 - 8
spine-cpp/spine-cpp/src/spine/PathAttachment.cpp

@@ -61,12 +61,4 @@ void PathAttachment::setConstantSpeed(bool inValue) {
 	_constantSpeed = inValue;
 }
 
-String PathAttachment::toString() const {
-	String str;
-	str.append("PathAttachment { name: ").appendString(getName()).append(", closed: ").append(_closed).append(
-			", constantSpeed: ").append(_constantSpeed);
-	str.append(", worldVerticesLength: ").append(_worldVerticesLength);
-	str.append(", bones: ").append(_bones).append(", weights: ").append(_vertices).append(" }");
-	return str;
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/PathConstraint.cpp

@@ -547,9 +547,4 @@ void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, fl
 	}
 }
 
-String PathConstraint::toString() const {
-	String str;
-	str.append("TransformConstraint { name: ").appendString(_data.getName()).append(" }");
-	return str;
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp

@@ -139,9 +139,4 @@ void PathConstraintData::setTranslateMix(float inValue) {
 	_translateMix = inValue;
 }
 
-String PathConstraintData::toString() const {
-	String str;
-	str.append("PathConstraintData { name: ").appendString(_name).append(" }");
-	return str;
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/PointAttachment.cpp

@@ -77,9 +77,4 @@ void PointAttachment::setRotation(float inValue) {
 	_rotation = inValue;
 }
 
-String PointAttachment::toString() const {
-	String str;
-	str.append("PointAttachment { name: ").appendString(getName()).append(" }");
-	return str;
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/RTTI.cpp

@@ -60,9 +60,4 @@ bool RTTI::instanceOf(const RTTI &rtti) const {
 	return false;
 }
 
-String RTTI::toString() const {
-	String str;
-	str.append("RTTI { name: ").append(_className.c_str()).append(" }");
-	return str;
-}
 }

+ 0 - 6
spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp

@@ -283,10 +283,4 @@ Vector<float> &RegionAttachment::getUVs() {
 Spine::Color &RegionAttachment::getColor() {
 	return _color;
 }
-
-String RegionAttachment::toString() const {
-	String str;
-	str.append("RegionAttachment { name: ").appendString(getName()).append(", path: ").appendString(_path).append(" }");
-	return str;
-}
 }

+ 0 - 12
spine-cpp/spine-cpp/src/spine/Skeleton.cpp

@@ -644,16 +644,4 @@ void Skeleton::sortReset(Vector<Bone *> &bones) {
 		bone->_sorted = false;
 	}
 }
-
-String Skeleton::toString() const {
-	String str;
-
-	str.append("Skeleton {\n");
-	str.append("   bones: ").append(_bones);
-	str.append(",\n slots: ").append(_slots);
-	str.append(",\n drawOrder: ").append(_drawOrder);
-	str.append(",\n animations: ").append(_data->getAnimations());
-	str.append(" }");
-	return str;
-}
 }

+ 0 - 4
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -1008,8 +1008,4 @@ void SkeletonBinary::readCurve(DataInput *input, int frameIndex, CurveTimeline *
 		}
 	}
 }
-
-String SkeletonBinary::toString() const {
-	return String("SkeletonBinary");
-}
 }

+ 0 - 9
spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp

@@ -232,14 +232,5 @@ void SkeletonBounds::aabbCompute() {
 	_maxY = maxY;
 }
 
-String SkeletonBounds::toString() const {
-	return String("SkeletonBounds");
-}
-
-String Polygon::toString() const {
-	String str;
-	str.append("Polygon { count: ").append(_count).append(", vertices: ").append(_vertices).append(" }");
-	return str;
-}
 }
 

+ 8 - 13
spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp

@@ -52,20 +52,17 @@ int SkeletonClipping::clipStart(Slot &slot, ClippingAttachment *clip) {
 	_clippingPolygon.setSize(n, 0);
 	clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2);
 	makeClockwise(_clippingPolygon);
-	Vector<Vector<float> *> clippingPolygons = _triangulator.decompose(_clippingPolygon,
-																	   _triangulator.triangulate(_clippingPolygon));
+	_clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
 
-	_clippingPolygons.clearAndAddAll(clippingPolygons);
-
-	for (size_t i = 0; i < _clippingPolygons.size(); ++i) {
-		Vector<float> *polygonP = _clippingPolygons[i];
+	for (size_t i = 0; i < _clippingPolygons->size(); ++i) {
+		Vector<float> *polygonP = (*_clippingPolygons)[i];
 		Vector<float> &polygon = *polygonP;
 		makeClockwise(polygon);
 		polygon.add(polygon[0]);
 		polygon.add(polygon[1]);
 	}
 
-	return static_cast<int>(_clippingPolygons.size());
+	return static_cast<int>((*_clippingPolygons).size());
 }
 
 void SkeletonClipping::clipEnd(Slot &slot) {
@@ -80,8 +77,9 @@ void SkeletonClipping::clipEnd() {
 	}
 
 	_clipAttachment = NULL;
-	_clippingPolygons.clear();
+	_clippingPolygons = NULL;
 	_clippedVertices.clear();
+	_clippedUVs.clear();
 	_clippedTriangles.clear();
 	_clippingPolygon.clear();
 }
@@ -91,8 +89,8 @@ void SkeletonClipping::clipTriangles(Vector<float> &vertices, int verticesLength
 	Vector<float> &clipOutput = _clipOutput;
 	Vector<float> &clippedVertices = _clippedVertices;
 	Vector<unsigned short> &clippedTriangles = _clippedTriangles;
-	Vector<Vector<float> *> &polygons = _clippingPolygons;
-	int polygonsCount = static_cast<int>(_clippingPolygons.size());
+	Vector<Vector<float> *> &polygons = *_clippingPolygons;
+	int polygonsCount = static_cast<int>((*_clippingPolygons).size());
 
 	int index = 0;
 	clippedVertices.clear();
@@ -318,7 +316,4 @@ void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
 	}
 }
 
-String SkeletonClipping::toString() const {
-	return String("SkeletonClipping");
-}
 }

+ 0 - 4
spine-cpp/spine-cpp/src/spine/SkeletonData.cpp

@@ -230,8 +230,4 @@ float SkeletonData::getFps() {
 void SkeletonData::setFps(float inValue) {
 	_fps = inValue;
 }
-
-String SkeletonData::toString() const {
-	return String("SkeletonData");
-}
 }

+ 0 - 4
spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp

@@ -1213,8 +1213,4 @@ void SkeletonJson::setError(Json *root, const String &value1, const String &valu
 
 	delete root;
 }
-
-String SkeletonJson::toString() const {
-	return String("SkeletonJson");
-}
 }

+ 0 - 14
spine-cpp/spine-cpp/src/spine/Skin.cpp

@@ -47,12 +47,6 @@ bool Skin::AttachmentKey::operator==(const AttachmentKey &other) const {
 	return _slotIndex == other._slotIndex && _name == other._name;
 }
 
-String Skin::AttachmentKey::toString() const {
-	String str;
-	str.append("AttachmentKey { slotIndex: ").append(_slotIndex).append(", name: ").appendString(_name).append(" }");
-	return str;
-}
-
 std::size_t Skin::HashAttachmentKey::operator()(const Spine::Skin::AttachmentKey &val) const {
 	std::size_t h1 = val._slotIndex;
 	return h1;
@@ -128,12 +122,4 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
 		}
 	}
 }
-
-String Skin::toString() const {
-	String str;
-	str.append("Skin { name: ").appendString(_name);
-	str.append(",\n attachments: ").append(_attachments);
-	str.append(" }");
-	return str;
-}
 }

+ 0 - 8
spine-cpp/spine-cpp/src/spine/Slot.cpp

@@ -118,12 +118,4 @@ void Slot::setAttachmentVertices(Vector<float> &inValue) {
 	_attachmentVertices.clearAndAddAll(inValue);
 }
 
-String Slot::toString() const {
-	String str;
-	str.append("Slot { name: ").appendString(_data.getName());
-	str.append(", color: ").appendString(_color.toString());
-	if (_hasDarkColor) str.append(", darkColor: ").appendString(_darkColor.toString());
-	str.append("}");
-	return str;
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/SlotData.cpp

@@ -90,7 +90,4 @@ void SlotData::setBlendMode(BlendMode inValue) {
 	_blendMode = inValue;
 }
 
-String SlotData::toString() const {
-	return String("SlotData");
-}
 }

+ 0 - 5
spine-cpp/spine-cpp/src/spine/Timeline.cpp

@@ -42,9 +42,4 @@ Timeline::Timeline() {
 Timeline::~Timeline() {
 }
 
-String Timeline::toString() const {
-	String str;
-	str.appendString(getRTTI().toString());
-	return str;
-}
 }

+ 0 - 6
spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp

@@ -376,10 +376,4 @@ void TransformConstraint::applyRelativeLocal() {
 		bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY);
 	}
 }
-
-String TransformConstraint::toString() const {
-	String str;
-	str.append("TransformConstraint { name: ").appendString(_data.getName()).append(" }");
-	return str;
-}
 }

+ 0 - 3
spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp

@@ -118,7 +118,4 @@ bool TransformConstraintData::isLocal() {
 	return _local;
 }
 
-String TransformConstraintData::toString() const {
-	return String("TransformConstraintData");
-}
 }

+ 8 - 5
spine-cpp/spine-cpp/src/spine/Triangulator.cpp

@@ -33,6 +33,12 @@
 #include <spine/MathUtil.h>
 
 namespace Spine {
+
+Triangulator::~Triangulator() {
+	ContainerUtil::cleanUpVectorOfPointers(_convexPolygons);
+	ContainerUtil::cleanUpVectorOfPointers(_convexPolygonsIndices);
+}
+
 Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
 	int vertexCount = static_cast<int>(vertices.size() >> 1);
 
@@ -123,14 +129,14 @@ Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
 	return triangles;
 }
 
-Vector<Vector<float> *> Triangulator::decompose(Vector<float> &vertices, Vector<int> &triangles) {
+Vector<Vector<float> *> &Triangulator::decompose(Vector<float> &vertices, Vector<int> &triangles) {
 	Vector<Vector<float> *> &convexPolygons = _convexPolygons;
 	for (size_t i = 0, n = convexPolygons.size(); i < n; ++i) {
 		_polygonPool.free(convexPolygons[i]);
 	}
 	convexPolygons.clear();
 
-	Vector<Vector<int> *> convexPolygonsIndices = _convexPolygonsIndices;
+	Vector<Vector<int> *> &convexPolygonsIndices = _convexPolygonsIndices;
 	for (size_t i = 0, n = convexPolygonsIndices.size(); i < n; ++i) {
 		_polygonIndicesPool.free(convexPolygonsIndices[i]);
 	}
@@ -291,7 +297,4 @@ int Triangulator::winding(float p1x, float p1y, float p2x, float p2y, float p3x,
 	return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
 }
 
-String Triangulator::toString() const {
-	return String("Triangulator");
-}
 }

+ 13 - 4
spine-sfml/cpp/example/main.cpp

@@ -197,6 +197,8 @@ void goblins (SkeletonData* skeletonData, Atlas* atlas) {
 		window.draw(*drawable);
 		window.display();
 	}
+
+	delete drawable;
 }
 
 void raptor (SkeletonData* skeletonData, Atlas* atlas) {
@@ -238,6 +240,8 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) {
 		window.display();
 	}
 	// BOZO spSwirlVertexEffect_dispose(effect);
+
+	delete drawable;
 }
 
 void tank (SkeletonData* skeletonData, Atlas* atlas) {
@@ -266,6 +270,8 @@ void tank (SkeletonData* skeletonData, Atlas* atlas) {
 		window.draw(*drawable);
 		window.display();
 	}
+
+	delete drawable;
 }
 
 void vine (SkeletonData* skeletonData, Atlas* atlas) {
@@ -295,6 +301,8 @@ void vine (SkeletonData* skeletonData, Atlas* atlas) {
 		window.draw(*drawable);
 		window.display();
 	}
+
+	delete drawable;
 }
 
 void stretchyman (SkeletonData* skeletonData, Atlas* atlas) {
@@ -360,6 +368,8 @@ void coin (SkeletonData* skeletonData, Atlas* atlas) {
 		window.draw(*drawable);
 		window.display();
 	}
+
+	delete drawable;
 }
 
 void owl (SkeletonData* skeletonData, Atlas* atlas) {
@@ -413,6 +423,8 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
 		window.draw(*drawable);
 		window.display();
 	}
+
+	delete drawable;
 }
 
 /**
@@ -429,8 +441,6 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
 		animState->update(d);
 		animState->apply(*skeleton);
 		skeleton->updateWorldTransform();
-		printf("%s\n", skeleton->toString().buffer());
-		printf("========================================\n");
 		d += 0.1f;
 	}
 
@@ -441,9 +451,8 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
 
 int main () {
 	DebugExtension dbgExtension;
-	// SpineExtension::setInstance(&dbgExtension);
+	SpineExtension::setInstance(&dbgExtension);
 	testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f);
-	testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);
 	testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f);
 	testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl.atlas", 0.5f);
 	testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);