• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 "ui/rs_display_node.h"
17 
18 #include "command/rs_display_node_command.h"
19 #include "platform/common/rs_log.h"
20 #include "transaction/rs_transaction_proxy.h"
21 #include "pipeline/rs_node_map.h"
22 namespace OHOS {
23 namespace Rosen {
24 
Create(const RSDisplayNodeConfig & displayNodeConfig)25 RSDisplayNode::SharedPtr RSDisplayNode::Create(const RSDisplayNodeConfig& displayNodeConfig)
26 {
27     SharedPtr node(new RSDisplayNode(displayNodeConfig));
28     RSNodeMap::MutableInstance().RegisterNode(node);
29 
30     std::unique_ptr<RSCommand> command = std::make_unique<RSDisplayNodeCreate>(node->GetId(), displayNodeConfig);
31     auto transactionProxy = RSTransactionProxy::GetInstance();
32     if (transactionProxy != nullptr) {
33         transactionProxy->AddCommand(command, true);
34     }
35     ROSEN_LOGD("RSDisplayNode::Create, id:%llu", node->GetId());
36     return node;
37 }
38 
SetScreenId(uint64_t screenId)39 void RSDisplayNode::SetScreenId(uint64_t screenId)
40 {
41     std::unique_ptr<RSCommand> command = std::make_unique<RSDisplayNodeSetScreenId>(GetId(), screenId);
42     auto transactionProxy = RSTransactionProxy::GetInstance();
43     if (transactionProxy != nullptr) {
44         transactionProxy->AddCommand(command, true);
45     }
46     ROSEN_LOGD("RSDisplayNode::SetScreenId, ScreenId:%llu", screenId);
47 }
48 
SetSecurityDisplay(bool isSecurityDisplay)49 void RSDisplayNode::SetSecurityDisplay(bool isSecurityDisplay)
50 {
51     isSecurityDisplay_ = isSecurityDisplay;
52     std::unique_ptr<RSCommand> command = std::make_unique<RSDisplayNodeSetSecurityDisplay>(GetId(), isSecurityDisplay);
53     auto transactionProxy = RSTransactionProxy::GetInstance();
54     if (transactionProxy != nullptr) {
55         transactionProxy->AddCommand(command, true);
56     }
57     ROSEN_LOGD("RSDisplayNode::SetSecurityDisplay, displayNodeId:[%llu] isSecurityDisplay:[%s]", GetId(),
58         isSecurityDisplay ? "true" : "false");
59 }
60 
GetSecurityDisplay() const61 bool RSDisplayNode::GetSecurityDisplay() const
62 {
63     return isSecurityDisplay_;
64 }
65 
RSDisplayNode(const RSDisplayNodeConfig & config)66 RSDisplayNode::RSDisplayNode(const RSDisplayNodeConfig& config)
67     : RSBaseNode(true), screenId_(config.screenId)
68 {
69     (void)screenId_;
70 }
71 
~RSDisplayNode()72 RSDisplayNode::~RSDisplayNode() {}
73 
74 } // namespace Rosen
75 } // namespace OHOS
76