Add ApplyCustomFragmentPrefix
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / vertex-buffer-impl.h
index d6207e0..dcba098 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_VERTEX_BUFFER_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
+#include <dali/public-api/common/dali-common.h>   // DALI_ASSERT_ALWAYS
 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
 #include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/property-map.h> // Dali::Property::Map
+#include <dali/public-api/object/property-map.h>     // Dali::Property::Map
+#include <dali/public-api/rendering/vertex-buffer.h> // Dali::VertexBuffer
+
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/render/renderers/render-vertex-buffer.h>
 
 namespace Dali
 {
+class VertexBuffer;
 namespace Internal
 {
-
 class VertexBuffer;
-typedef IntrusivePtr<VertexBuffer> VertexBufferPtr;
+using VertexBufferPtr = IntrusivePtr<VertexBuffer>;
 
 /**
  * VertexBuffer is an object that contains an array of structures of values that
@@ -41,16 +43,15 @@ typedef IntrusivePtr<VertexBuffer> VertexBufferPtr;
 class VertexBuffer : public BaseObject
 {
 public:
-
   /**
    * @copydoc PropertBuffer::New()
    */
-  static VertexBufferPtr New( Dali::Property::Map& format );
+  static VertexBufferPtr New(Dali::Property::Map& format);
 
   /**
    * @copydoc PropertBuffer::SetData()
    */
-  void SetData( const void* data, uint32_t size );
+  void SetData(const void* data, uint32_t size);
 
   /**
    * @copydoc PropertBuffer::GetSize()
@@ -58,7 +59,6 @@ public:
   uint32_t GetSize() const;
 
 public: // Default property extensions from Object
-
   /**
    * @brief Get the render thread side of the VertexBuffer
    *
@@ -70,7 +70,7 @@ protected:
   /**
    * @brief Destructor
    */
-  ~VertexBuffer();
+  ~VertexBuffer() override;
 
 private: // implementation
   /**
@@ -81,38 +81,79 @@ private: // implementation
   /**
    * Second stage initialization
    */
-  void Initialize( Dali::Property::Map& format );
+  void Initialize(Dali::Property::Map& format);
 
 private: // unimplemented methods
-  VertexBuffer( const VertexBuffer& );
-  VertexBuffer& operator=( const VertexBuffer& );
+  VertexBuffer(const VertexBuffer&);
+  VertexBuffer& operator=(const VertexBuffer&);
 
-private: // data
-  EventThreadServices& mEventThreadServices;    ///<Used to send messages to the render thread via update thread
+private:                                      // data
+  EventThreadServices&  mEventThreadServices; ///<Used to send messages to the render thread via update thread
   Render::VertexBuffer* mRenderObject;        ///<Render side object
-  uint32_t mBufferFormatSize;
-  uint32_t mSize; ///< Number of elements in the buffer
+  uint32_t              mBufferFormatSize;
+  uint32_t              mSize; ///< Number of elements in the buffer
 };
 
 /**
  * Get the implementation type from a Property::Type
  */
-template<Property::Type type> struct PropertyImplementationType
+template<Property::Type type>
+struct PropertyImplementationType
 {
   // typedef ... Type; not defined, only support types declared below
 };
-template<> struct PropertyImplementationType< Property::BOOLEAN > { typedef bool Type; };
-template<> struct PropertyImplementationType< Property::FLOAT > { typedef float Type; };
-template<> struct PropertyImplementationType< Property::INTEGER > { typedef int Type; };
-template<> struct PropertyImplementationType< Property::VECTOR2 > { typedef Vector2 Type; };
-template<> struct PropertyImplementationType< Property::VECTOR3 > { typedef Vector3 Type; };
-template<> struct PropertyImplementationType< Property::VECTOR4 > { typedef Vector4 Type; };
-template<> struct PropertyImplementationType< Property::MATRIX3 > { typedef Matrix3 Type; };
-template<> struct PropertyImplementationType< Property::MATRIX > { typedef Matrix Type; };
-template<> struct PropertyImplementationType< Property::RECTANGLE > { typedef Rect<int> Type; };
-template<> struct PropertyImplementationType< Property::ROTATION > { typedef Quaternion Type; };
-
-uint32_t GetPropertyImplementationSize( Property::Type& propertyType );
+template<>
+struct PropertyImplementationType<Property::BOOLEAN>
+{
+  using Type = bool;
+};
+template<>
+struct PropertyImplementationType<Property::FLOAT>
+{
+  using Type = float;
+};
+template<>
+struct PropertyImplementationType<Property::INTEGER>
+{
+  using Type = int;
+};
+template<>
+struct PropertyImplementationType<Property::VECTOR2>
+{
+  using Type = Vector2;
+};
+template<>
+struct PropertyImplementationType<Property::VECTOR3>
+{
+  using Type = Vector3;
+};
+template<>
+struct PropertyImplementationType<Property::VECTOR4>
+{
+  using Type = Vector4;
+};
+template<>
+struct PropertyImplementationType<Property::MATRIX3>
+{
+  using Type = Matrix3;
+};
+template<>
+struct PropertyImplementationType<Property::MATRIX>
+{
+  using Type = Matrix;
+};
+template<>
+struct PropertyImplementationType<Property::RECTANGLE>
+{
+  using Type = Rect<int>;
+};
+template<>
+struct PropertyImplementationType<Property::ROTATION>
+{
+  using Type = Quaternion;
+};
+
+uint32_t GetPropertyImplementationSize(Property::Type& propertyType);
 
 } // namespace Internal