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_texture_node.h"
17
18 #include "platform/common/rs_log.h"
19 #include "transaction/rs_transaction_proxy.h"
20 #include "pipeline/rs_node_map.h"
21 #include "ui/rs_ui_director.h"
22
23 namespace OHOS {
24 namespace Rosen {
Create()25 std::shared_ptr<RSNode> RSTextureNode::Create()
26 {
27 #ifdef USE_FLUTTER_TEXTURE
28 std::shared_ptr<RSTextureNode> node(new RSTextureNode());
29 RSNodeMap::MutableInstance().RegisterNode(node);
30
31 // RSMsgPtr msgPtr = std::make_unique<CreateTextureNodeMsg>(node->GetId());
32 // auto transactionProxy = RSTransactionProxy::GetInstance();
33 // if (transactionProxy != nullptr) {
34 // transactionProxy->AddCommand(command, IsRenderServiceNode());
35 // }
36 return node;
37 #else
38 return RSCanvasNode::Create();
39 #endif
40 }
41
SetTextureRegistry(std::shared_ptr<flutter::OHOS::TextureRegistry> registry)42 void RSTextureNode::SetTextureRegistry(std::shared_ptr<flutter::OHOS::TextureRegistry> registry)
43 {
44 // RSMsgPtr msgPtr = std::make_unique<SetRegistryMsg>(registry);
45 // auto transactionProxy = RSTransactionProxy::GetInstance();
46 // if (transactionProxy != nullptr) {
47 // transactionProxy->AddCommand(command, IsRenderServiceNode());
48 // }
49 }
50
RSTextureNode(bool isRenderServiceNode)51 RSTextureNode::RSTextureNode(bool isRenderServiceNode) : RSCanvasNode(isRenderServiceNode) {}
52
UpdateTexture(int64_t textureId,bool freeze,RectF drawRect)53 void RSTextureNode::UpdateTexture(int64_t textureId, bool freeze, RectF drawRect)
54 {
55 // RSMsgPtr msgPtr = std::make_unique<UpdateTextureMsg>(GetId(), textureId, freeze, drawRect);
56 // auto transactionProxy = RSTransactionProxy::GetInstance();
57 // if (transactionProxy != nullptr) {
58 // transactionProxy->AddCommand(command, IsRenderServiceNode());
59 // }
60 }
61 } // namespace Rosen
62 } // namespace OHOS
63