Merge "Clean up the code to build successfully on macOS" into devel/master
[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() = default;
35
36 VertexBuffer::~VertexBuffer() = default;
37
38 VertexBuffer::VertexBuffer(const VertexBuffer& handle) = default;
39
40 VertexBuffer VertexBuffer::DownCast(BaseHandle handle)
41 {
42   return VertexBuffer(dynamic_cast<Dali::Internal::VertexBuffer*>(handle.GetObjectPtr()));
43 }
44
45 VertexBuffer& VertexBuffer::operator=(const VertexBuffer& handle) = default;
46
47 VertexBuffer::VertexBuffer(VertexBuffer&& rhs) = default;
48
49 VertexBuffer& VertexBuffer::operator=(VertexBuffer&& rhs) = default;
50
51 void VertexBuffer::SetData(const void* data, std::size_t size)
52 {
53   GetImplementation(*this).SetData(data, static_cast<uint32_t>(size)); // only support 4,294,967,295 bytes
54 }
55
56 std::size_t VertexBuffer::GetSize() const
57 {
58   return GetImplementation(*this).GetSize();
59 }
60
61 VertexBuffer::VertexBuffer(Internal::VertexBuffer* pointer)
62 : BaseHandle(pointer)
63 {
64 }
65
66 } // namespace Dali