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 
17 #include "command/rs_base_node_command.h"
18 #include "platform/common/rs_log.h"
19 #include "transaction/rs_render_service_client.h"
20 #include "transaction/rs_transaction_proxy.h"
21 
22 using namespace OHOS;
23 using namespace OHOS::Rosen;
24 
main()25 int main()
26 {
27     std::unique_ptr<RSCommand> command = std::make_unique<RSBaseNodeAddChild>(1, 1, 1);
28     auto renderClient = RSIRenderClient::CreateRenderServiceClient();
29     auto transactionProxy = RSTransactionProxy::GetInstance();
30     if (transactionProxy != nullptr) {
31         transactionProxy->SetRenderServiceClient(renderClient);
32         transactionProxy->AddCommand(command);
33         transactionProxy->FlushImplicitTransaction();
34     }
35     // create surface
36     RSSurfaceRenderNodeConfig config = {.id=0, .name="testSurface"};
37     std::shared_ptr<RSSurface> testSurface =
38         std::static_pointer_cast<RSRenderServiceClient>(renderClient)->CreateNodeAndSurface(config);
39     auto frame = testSurface->RequestFrame(1600, 1600);
40     frame->SetDamageRegion(0, 0, 1600, 1600);
41     testSurface->FlushFrame(frame);
42     while(1);
43     return 0;
44 }
45