• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 "rs_render_task.h"
17 #include "pipeline/rs_base_render_node.h"
18 
19 namespace OHOS {
20 namespace Rosen {
~RSSuperRenderTask()21 RSSuperRenderTask::~RSSuperRenderTask()
22 {
23     while (GetTaskSize() > 0) {
24         tasks_.pop();
25     }
26 }
27 
AddTask(std::unique_ptr<RSRenderTask> && task)28 void RSSuperRenderTask::AddTask(std::unique_ptr<RSRenderTask> &&task)
29 {
30     if (task == nullptr) {
31         RS_LOGE("task is nullptr");
32         return;
33     }
34     tasks_.push(std::move(task));
35 }
36 
GetSurfaceNode()37 std::shared_ptr<RSBaseRenderNode> RSSuperRenderTask::GetSurfaceNode()
38 {
39     if (GetTaskSize() == 0) {
40         return nullptr;
41     }
42     auto surfaceNode = tasks_.front()->GetNode();
43     tasks_.pop();
44     return surfaceNode;
45 }
46 
GetNextRenderTask()47 std::unique_ptr<RSRenderTask> RSSuperRenderTask::GetNextRenderTask()
48 {
49     if (GetTaskSize() == 0) {
50         return std::unique_ptr<RSRenderTask>();
51     }
52     auto task = std::move(tasks_.front());
53     tasks_.pop();
54     return task;
55 }
56 
57 } // namespace Rosen
58 } // namespace OHOS