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