Merge changes I84e1ce43,I76b93d51 into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-property-buffer.h
index 5cc92f4..b568259 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_RENDER_PROPERTY_BUFFER_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <dali/internal/common/owner-pointer.h>
 #include <dali/public-api/actors/sampling.h>
-#include <dali/devel-api/rendering/sampler.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/internal/common/owner-pointer.h>
 #include <dali/internal/render/renderers/render-sampler.h>
 #include <dali/internal/render/gl-resources/gpu-buffer.h>
 
@@ -93,9 +94,8 @@ public:
   /**
    * Perform the upload of the buffer only when requiered
    * @param[in] context The GL context
-   * @param[in] isIndexBuffer True if the buffer is used as an index buffer
    */
-  bool Update( Context& context, bool isIndexBuffer );
+  bool Update( Context& context );
 
   /**
    * Enable the vertex attributes for each vertex buffer from the corresponding
@@ -156,21 +156,45 @@ public:
     return mSize;
   }
 
+  /**
+   * Retrieve reference to the data storage vector
+   * @return Reference to the data storage
+   */
+  inline const Dali::Vector< char >& GetData() const
+  {
+    return *mData.Get();
+  }
+
+  /**
+   * Retrieve data writeable pointer ( direct access to the buffer data )
+   * @return Pointer to data converted to requested type
+   */
+  template <typename T>
+  inline T* GetDataTypedPtr()
+  {
+    Dali::Vector< char >* data = mData.Release();
+    mData = data;
+    return reinterpret_cast<T*>( &data->operator[]( 0 ) );
+  }
+
+  inline const PropertyBuffer::Format* GetFormat() const
+  {
+    return mFormat.Get();
+  }
+
 private:
-  OwnerPointer< PropertyBuffer::Format >  mFormat;  ///< Format of the buffer
-  OwnerPointer< Dali::Vector< char > >    mData;    ///< Data
-  OwnerPointer<GpuBuffer> mGpuBuffer;               ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer
+  OwnerPointer< PropertyBuffer::Format >  mFormat;    ///< Format of the buffer
+  OwnerPointer< Dali::Vector< char > >    mData;      ///< Data
+  OwnerPointer< GpuBuffer >               mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer
 
-  size_t  mSize;      ///< Number of Elements in the buffer
+  size_t mSize;       ///< Number of Elements in the buffer
   bool mDataChanged;  ///< Flag to know if data has changed in a frame
-
 };
 
 } // namespace Render
 
-
-
 } // namespace Internal
+
 } // namespace Dali