Index: src/gpu/GrGeometryData.h |
diff --git a/src/gpu/GrGeometryData.h b/src/gpu/GrGeometryData.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a4e9fe6871165d09f41156b5891e5275948bb174 |
--- /dev/null |
+++ b/src/gpu/GrGeometryData.h |
@@ -0,0 +1,42 @@ |
+/* |
+ * Copyright 2014 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef GrGeometryData_DEFINED |
+#define GrGeometryData_DEFINED |
+ |
+#include <new> |
+#include "SkTypes.h" |
+ |
+/* |
+ * A super lightweight base class for GeometryProcessor's to use to store draw data in a reorderable |
+ * fashion. Its most important feature is a pool allocator. Its virtual, but only so subclasses |
+ * will have their destructors called. |
+ */ |
+ |
+class GrGeometryData : SkNoncopyable { |
+public: |
+ virtual ~GrGeometryData() {} |
+ |
+ /** |
+ * Helper for down-casting to a GrGeometryData subclass |
+ */ |
+ template <typename T> const T& cast() const { return *static_cast<const T*>(this); } |
+ |
+ void* operator new(size_t size); |
+ |
+ void operator delete(void* target); |
+ |
+ void* operator new(size_t size, void* placement) { |
+ return ::operator new(size, placement); |
+ } |
+ |
+ void operator delete(void* target, void* placement) { |
+ ::operator delete(target, placement); |
+ } |
+}; |
+ |
+#endif |