• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "modifier/rs_property_modifier.h"
17 
18 #include "modifier/rs_modifier_type.h"
19 #include "modifier/rs_render_modifier.h"
20 
21 namespace OHOS {
22 namespace Rosen {
23 #define DECLARE_ANIMATABLE_MODIFIER(MODIFIER_NAME, TYPE, MODIFIER_TYPE, DELTA_OP)                                     \
24     RS##MODIFIER_NAME##Modifier::RS##MODIFIER_NAME##Modifier(const std::shared_ptr<RSPropertyBase>& property)         \
25         : RSModifier(property, RSModifierType::MODIFIER_TYPE)                                                         \
26     {}                                                                                                                \
27     RSModifierType RS##MODIFIER_NAME##Modifier::GetModifierType() const                                               \
28     {                                                                                                                 \
29         return RSModifierType::MODIFIER_TYPE;                                                                         \
30     }                                                                                                                 \
31     std::shared_ptr<RSRenderModifier> RS##MODIFIER_NAME##Modifier::CreateRenderModifier() const                       \
32     {                                                                                                                 \
33         auto renderProperty = property_->CreateRenderProperty();                                                      \
34         auto renderModifier = std::make_shared<RS##MODIFIER_NAME##RenderModifier>(renderProperty);                    \
35         return renderModifier;                                                                                        \
36     }
37 
38 #define DECLARE_NOANIMATABLE_MODIFIER(MODIFIER_NAME, TYPE, MODIFIER_TYPE)                                             \
39     RS##MODIFIER_NAME##Modifier::RS##MODIFIER_NAME##Modifier(const std::shared_ptr<RSPropertyBase>& property)         \
40         : RSModifier(property, RSModifierType::MODIFIER_TYPE)                                                         \
41     {}                                                                                                                \
42     RSModifierType RS##MODIFIER_NAME##Modifier::GetModifierType() const                                               \
43     {                                                                                                                 \
44         return RSModifierType::MODIFIER_TYPE;                                                                         \
45     }                                                                                                                 \
46     std::shared_ptr<RSRenderModifier> RS##MODIFIER_NAME##Modifier::CreateRenderModifier() const                       \
47     {                                                                                                                 \
48         auto renderProperty = property_->CreateRenderProperty();                                                      \
49         auto renderModifier = std::make_shared<RS##MODIFIER_NAME##RenderModifier>(renderProperty);                    \
50         return renderModifier;                                                                                        \
51     }
52 
53 #include "modifier/rs_modifiers_def.in"
54 
55 #undef DECLARE_ANIMATABLE_MODIFIER
56 #undef DECLARE_NOANIMATABLE_MODIFIER
57 } // namespace Rosen
58 } // namespace OHOS
59