Merge changes I84e1ce43,I76b93d51 into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-property-buffer.h
index 94dee12..b568259 100644 (file)
@@ -16,9 +16,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <dali/public-api/common/vector-wrapper.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>
@@ -156,14 +156,39 @@ 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
   bool mDataChanged;  ///< Flag to know if data has changed in a frame
-
 };
 
 } // namespace Render