• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_NODE_SHOWING_COMMAND_H
17 #define ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_NODE_SHOWING_COMMAND_H
18 
19 #include "command/rs_command.h"
20 #include "command/rs_command_factory.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class RSRenderPropertyBase;
25 
26 enum RSNodeShowingCommandType : uint16_t {
27     GET_RENDER_PROPERTY,
28 };
29 
30 class RSB_EXPORT RSNodeGetShowingPropertyAndCancelAnimation : public RSSyncTask {
31     constexpr static uint16_t commandType = RS_NODE_SYNCHRONOUS_READ_PROPERTY;
32     constexpr static uint16_t commandSubType = GET_RENDER_PROPERTY;
33 
34 public:
35     explicit RSNodeGetShowingPropertyAndCancelAnimation(
36         NodeId targetId, std::shared_ptr<RSRenderPropertyBase> property, uint64_t timeoutNS = 1e8)
RSSyncTask(timeoutNS)37         : RSSyncTask(timeoutNS), targetId_(targetId), property_(property)
38     {}
39     RSNodeGetShowingPropertyAndCancelAnimation(const RSNodeGetShowingPropertyAndCancelAnimation&) = delete;
40     RSNodeGetShowingPropertyAndCancelAnimation& operator=(const RSNodeGetShowingPropertyAndCancelAnimation&) = delete;
41     RSNodeGetShowingPropertyAndCancelAnimation(RSNodeGetShowingPropertyAndCancelAnimation&&) = delete;
42     ~RSNodeGetShowingPropertyAndCancelAnimation() override = default;
43 
44     bool Marshalling(Parcel& parcel) const override;
45     static RSCommand* Unmarshalling(Parcel& parcel);
46 
47     bool CheckHeader(Parcel& parcel) const override;
48     bool ReadFromParcel(Parcel& parcel) override;
49 
50     static RSCommandRegister<commandType, commandSubType, Unmarshalling> registry;
51 
52     void Process(RSContext& context) override;
GetProperty()53     std::shared_ptr<RSRenderPropertyBase> GetProperty() const
54     {
55         return property_;
56     }
57 
58 private:
59     NodeId targetId_ = 0;
60     std::shared_ptr<RSRenderPropertyBase> property_;
61 };
62 
63 } // namespace Rosen
64 } // namespace OHOS
65 
66 #endif // ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_NODE_SHOWING_COMMAND_H