(Partial Update) Change damaged rect calcutation
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-functions.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/update/common/scene-graph-property-notification.h>
23 #include <dali/public-api/object/property-value.h>
24
25 // OTHER CONDITITION INCLUDES
26 #include <dali/internal/update/common/property-condition-step-functions.h>
27 #include <dali/internal/update/common/property-condition-variable-step-functions.h>
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33 class Object;
34 class PropertyNotification;
35
36 namespace SceneGraph
37 {
38 // LessThan ///////////////////////////////////////////////////////////////////
39
40 /**
41  * LessThan condition class,
42  * Checks if a Property is "Less Than" the argument:
43  *
44  * bool       => false (0.0) or true (1.0) is less than arg0.
45  * float      => value is less than arg0.
46  * Vector2    => 2 dimensional length of vector is less than arg0.
47  * Vector3    => 3 dimensional length of vector is less than arg0.
48  * Vector4    => 4 dimensional length of vector is less than arg0.
49  * Default    => return false.
50  */
51 class LessThan
52 {
53 public:
54   /**
55    * @return function pointer to the correct condition function, based on
56    * the type of value being examined.
57    */
58   static ConditionFunction GetFunction(Property::Type valueType);
59
60 private:
61   /**
62    * Checks if bool is LessThan
63    * @param[in] value The value being examined.
64    * @param[in] arg The supplied arguments for the condition.
65    * @return Condition result (true if condition met, false if not)
66    */
67   static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
68
69   /**
70    * Checks if integer is LessThan
71    * @param[in] value The value being examined.
72    * @param[in] arg The supplied arguments for the condition.
73    * @return Condition result (true if condition met, false if not)
74    */
75   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
76
77   /**
78    * Checks if float is LessThan
79    * @param[in] value The value being examined.
80    * @param[in] arg The supplied arguments for the condition.
81    * @return Condition result (true if condition met, false if not)
82    */
83   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
84
85   /**
86    * Checks if Vector2.Length() is LessThan
87    * @param[in] value The value being examined.
88    * @param[in] arg The supplied arguments for the condition.
89    * @return Condition result (true if condition met, false if not)
90    */
91   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
92
93   /**
94    * Checks if Vector3.Length() is LessThan
95    * @param[in] value The value being examined.
96    * @param[in] arg The supplied arguments for the condition.
97    * @return Condition result (true if condition met, false if not)
98    */
99   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
100
101   /**
102    * Checks if Vector4.Length() is LessThan
103    * @param[in] value The value being examined.
104    * @param[in] arg The supplied arguments for the condition.
105    * @return Condition result (true if condition met, false if not)
106    */
107   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
108
109   /**
110    * Default check for other types
111    * @param[in] value The value being examined.
112    * @param[in] arg The supplied arguments for the condition.
113    * @return Condition result (true if condition met, false if not)
114    */
115   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
116 };
117
118 // GreaterThan ////////////////////////////////////////////////////////////////
119
120 /**
121  * GreaterThan condition class,
122  * Checks if a Property is "Greater Than" the argument:
123  *
124  * bool       => false (0.0) or true (1.0) is greater than arg0.
125  * float      => value is greater than arg0.
126  * Vector2    => 2 dimensional length of vector is greater than arg0.
127  * Vector3    => 3 dimensional length of vector is greater than arg0.
128  * Vector4    => 4 dimensional length of vector is greater than arg0.
129  * Default    => return false.
130  */
131 class GreaterThan
132 {
133 public:
134   /**
135    * @returns function pointer to the correct condition function, based on
136    * the type of value being examined.
137    */
138   static ConditionFunction GetFunction(Property::Type valueType);
139
140 private:
141   /**
142    * Checks if bool is GreaterThan
143    * @param[in] value The value being examined.
144    * @param[in] arg The supplied arguments for the condition.
145    * @return Condition result (true if condition met, false if not)
146    */
147   static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
148
149   /**
150    * Checks if integer is GreaterThan
151    * @param[in] value The value being examined.
152    * @param[in] arg The supplied arguments for the condition.
153    * @return Condition result (true if condition met, false if not)
154    */
155   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
156
157   /**
158    * Checks if float is GreaterThan
159    * @param[in] value The value being examined.
160    * @param[in] arg The supplied arguments for the condition.
161    * @return Condition result (true if condition met, false if not)
162    */
163   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
164
165   /**
166    * Checks if Vector2.Length() is GreaterThan
167    * @param[in] value The value being examined.
168    * @param[in] arg The supplied arguments for the condition.
169    * @return Condition result (true if condition met, false if not)
170    */
171   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
172
173   /**
174    * Checks if Vector3.Length() is GreaterThan
175    * @param[in] value The value being examined.
176    * @param[in] arg The supplied arguments for the condition.
177    * @return Condition result (true if condition met, false if not)
178    */
179   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
180
181   /**
182    * Checks if Vector4.Length() is GreaterThan
183    * @param[in] value The value being examined.
184    * @param[in] arg The supplied arguments for the condition.
185    * @return Condition result (true if condition met, false if not)
186    */
187   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
188
189   /**
190    * Default check for other types.
191    * @param[in] value The value being examined.
192    * @param[in] arg The supplied arguments for the condition.
193    * @return Condition result (true if condition met, false if not)
194    */
195   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
196 };
197
198 // Inside /////////////////////////////////////////////////////////////////////
199
200 /**
201  * Inside condition class,
202  * Checks if a Property is "Inside" the two arguments:
203  *
204  * bool       => false (0.0) or true (1.0) is inside arg0.
205  * float      => value is between arg0 and arg1.
206  * Vector2    => 2 dimensional length of vector is between arg0 and arg1.
207  * Vector3    => 3 dimensional length of vector is between arg0 and arg1.
208  * Vector4    => 4 dimensional length of vector is between arg0 and arg1.
209  * Default    => return false.
210  */
211 class Inside
212 {
213 public:
214   /**
215    * @return function pointer to the correct condition function, based on
216    * the type of value being examined.
217    */
218   static ConditionFunction GetFunction(Property::Type valueType);
219
220 private:
221   /**
222    * Checks if bool is Inside
223    * @param[in] value The value being examined.
224    * @param[in] arg The supplied arguments for the condition.
225    * @return Condition result (true if condition met, false if not)
226    */
227   static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
228
229   /**
230    * Checks if integer is Inside
231    * @param[in] value The value being examined.
232    * @param[in] arg The supplied arguments for the condition.
233    * @return Condition result (true if condition met, false if not)
234    */
235   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
236
237   /**
238    * Checks if float is Inside
239    * @param[in] value The value being examined.
240    * @param[in] arg The supplied arguments for the condition.
241    * @return Condition result (true if condition met, false if not)
242    */
243   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
244
245   /**
246    * Checks if Vector2.Length() is Inside
247    * @param[in] value The value being examined.
248    * @param[in] arg The supplied arguments for the condition.
249    * @return Condition result (true if condition met, false if not)
250    */
251   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
252
253   /**
254    * Checks if Vector3.Length() is Inside
255    * @param[in] value The value being examined.
256    * @param[in] arg The supplied arguments for the condition.
257    * @return Condition result (true if condition met, false if not)
258    */
259   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
260
261   /**
262    * Checks if Vector4.Length() is Inside
263    * @param[in] value The value being examined.
264    * @param[in] arg The supplied arguments for the condition.
265    * @return Condition result (true if condition met, false if not)
266    */
267   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
268
269   /**
270    * Default check for other types.
271    * @param[in] value The value being examined.
272    * @param[in] arg The supplied arguments for the condition.
273    * @return Condition result (true if condition met, false if not)
274    */
275   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
276 };
277
278 // Outside ////////////////////////////////////////////////////////////////////
279
280 /**
281  * Outside condition class,
282  * Checks if a Property is "Outside" the two arguments:
283  *
284  * bool       => false (0.0) or true (1.0) is outside arg0.
285  * float      => value is outside arg0 and arg1.
286  * Vector2    => 2 dimensional length of vector is outside arg0 and arg1.
287  * Vector3    => 3 dimensional length of vector is outside arg0 and arg1.
288  * Vector4    => 4 dimensional length of vector is outside arg0 and arg1.
289  * Default    => return false.
290  */
291 class Outside
292 {
293 public:
294   /**
295    * @return function pointer to the correct condition function, based on
296    * the type of value being examined.
297    */
298   static ConditionFunction GetFunction(Property::Type valueType);
299
300 private:
301   /**
302    * Checks if bool is Outside
303    * @param[in] value The value being examined.
304    * @param[in] arg The supplied arguments for the condition.
305    * @return Condition result (true if condition met, false if not)
306    */
307   static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
308
309   /**
310    * Checks if integer is Outside
311    * @param[in] value The value being examined.
312    * @param[in] arg The supplied arguments for the condition.
313    * @return Condition result (true if condition met, false if not)
314    */
315   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
316
317   /**
318    * Checks if float is Outside
319    * @param[in] value The value being examined.
320    * @param[in] arg The supplied arguments for the condition.
321    * @return Condition result (true if condition met, false if not)
322    */
323   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
324
325   /**
326    * Checks if Vector2.Length() is Outside
327    * @param[in] value The value being examined.
328    * @param[in] arg The supplied arguments for the condition.
329    * @return Condition result (true if condition met, false if not)
330    */
331   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
332
333   /**
334    * Checks if Vector3.Length() is Outside
335    * @param[in] value The value being examined.
336    * @param[in] arg The supplied arguments for the condition.
337    * @return Condition result (true if condition met, false if not)
338    */
339   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
340
341   /**
342    * Checks if Vector4.Length() is Outside
343    * @param[in] value The value being examined.
344    * @param[in] arg The supplied arguments for the condition.
345    * @return Condition result (true if condition met, false if not)
346    */
347   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
348
349   /**
350    * Default check for other types.
351    * @param[in] value The value being examined.
352    * @param[in] arg The supplied arguments for the condition.
353    * @return Condition result (true if condition met, false if not)
354    */
355   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
356 };
357
358 } // namespace SceneGraph
359
360 } // namespace Internal
361
362 } // namespace Dali
363
364 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H