#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>
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