Formatted API
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / vertex-buffer.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/rendering/vertex-buffer.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/rendering/vertex-buffer-impl.h> // Dali::Internal::VertexBuffer
23 #include <dali/public-api/object/property-map.h>              // Dali::Property::Map
24
25 namespace Dali
26 {
27 VertexBuffer VertexBuffer::New(Dali::Property::Map& bufferFormat)
28 {
29   Internal::VertexBufferPtr vertexBuffer = Internal::VertexBuffer::New(bufferFormat);
30
31   return VertexBuffer(vertexBuffer.Get());
32 }
33
34 VertexBuffer::VertexBuffer()
35 {
36 }
37
38 VertexBuffer::~VertexBuffer()
39 {
40 }
41
42 VertexBuffer::VertexBuffer(const VertexBuffer& handle) = default;
43
44 VertexBuffer VertexBuffer::DownCast(BaseHandle handle)
45 {
46   return VertexBuffer(dynamic_cast<Dali::Internal::VertexBuffer*>(handle.GetObjectPtr()));
47 }
48
49 VertexBuffer& VertexBuffer::operator=(const VertexBuffer& handle) = default;
50
51 VertexBuffer::VertexBuffer(VertexBuffer&& rhs) = default;
52
53 VertexBuffer& VertexBuffer::operator=(VertexBuffer&& rhs) = default;
54
55 void VertexBuffer::SetData(const void* data, std::size_t size)
56 {
57   GetImplementation(*this).SetData(data, static_cast<uint32_t>(size)); // only support 4,294,967,295 bytes
58 }
59
60 std::size_t VertexBuffer::GetSize() const
61 {
62   return GetImplementation(*this).GetSize();
63 }
64
65 VertexBuffer::VertexBuffer(Internal::VertexBuffer* pointer)
66 : BaseHandle(pointer)
67 {
68 }
69
70 } // namespace Dali