f7d202ed584b9649ba768ccebad1cca25f5755c9
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / native-image-source-queue.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/devel-api/adaptor-framework/native-image-source-queue.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/imaging/common/native-image-source-factory.h>
23 #include <dali/internal/imaging/common/native-image-source-queue-impl.h>
24
25 namespace Dali
26 {
27 NativeImageSourceQueuePtr NativeImageSourceQueue::New(uint32_t width, uint32_t height, ColorDepth depth)
28 {
29   Any                       empty;
30   NativeImageSourceQueuePtr image = new NativeImageSourceQueue(width, height, depth, empty);
31   if(image->mImpl)
32   {
33     return image;
34   }
35   return nullptr;
36 }
37
38 NativeImageSourceQueuePtr NativeImageSourceQueue::New(Any nativeImageSourceQueue)
39 {
40   NativeImageSourceQueuePtr image = new NativeImageSourceQueue(0, 0, COLOR_DEPTH_DEFAULT, nativeImageSourceQueue);
41   if(image->mImpl)
42   {
43     return image;
44   }
45   return nullptr;
46 }
47
48 Any NativeImageSourceQueue::GetNativeImageSourceQueue()
49 {
50   return mImpl->GetNativeImageSourceQueue();
51 }
52
53 void NativeImageSourceQueue::SetSize(uint32_t width, uint32_t height)
54 {
55   return mImpl->SetSize(width, height);
56 }
57
58 void NativeImageSourceQueue::IgnoreSourceImage()
59 {
60   mImpl->IgnoreSourceImage();
61 }
62
63 bool NativeImageSourceQueue::CreateResource()
64 {
65   return mImpl->CreateResource();
66 }
67
68 void NativeImageSourceQueue::DestroyResource()
69 {
70   mImpl->DestroyResource();
71 }
72
73 uint32_t NativeImageSourceQueue::TargetTexture()
74 {
75   return mImpl->TargetTexture();
76 }
77
78 void NativeImageSourceQueue::PrepareTexture()
79 {
80   mImpl->PrepareTexture();
81 }
82
83 uint32_t NativeImageSourceQueue::GetWidth() const
84 {
85   return mImpl->GetWidth();
86 }
87
88 uint32_t NativeImageSourceQueue::GetHeight() const
89 {
90   return mImpl->GetHeight();
91 }
92
93 bool NativeImageSourceQueue::RequiresBlending() const
94 {
95   return mImpl->RequiresBlending();
96 }
97
98 int NativeImageSourceQueue::GetTextureTarget() const
99 {
100   return mImpl->GetTextureTarget();
101 }
102
103 const char* NativeImageSourceQueue::GetCustomFragmentPrefix() const
104 {
105   return mImpl->GetCustomFragmentPrefix();
106 }
107
108 bool NativeImageSourceQueue::ApplyNativeFragmentShader(std::string& shader)
109 {
110   return mImpl->ApplyNativeFragmentShader(shader);
111 }
112
113 const char* NativeImageSourceQueue::GetCustomSamplerTypename() const
114 {
115   return mImpl->GetCustomSamplerTypename();
116 }
117
118 Any NativeImageSourceQueue::GetNativeImageHandle() const
119 {
120   return mImpl->GetNativeImageHandle();
121 }
122
123 bool NativeImageSourceQueue::SourceChanged() const
124 {
125   return mImpl->SourceChanged();
126 }
127
128 NativeImageInterface::Extension* NativeImageSourceQueue::GetExtension()
129 {
130   return mImpl->GetNativeImageInterfaceExtension();
131 }
132
133 NativeImageSourceQueue::NativeImageSourceQueue(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSourceQueue)
134 {
135   auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory();
136   mImpl        = factory->CreateNativeImageSourceQueue(width, height, depth, nativeImageSourceQueue);
137 }
138
139 NativeImageSourceQueue::~NativeImageSourceQueue()
140 {
141 }
142
143 } // namespace Dali