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