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 #ifndef RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_RESULT_H 16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_RESULT_H 17 18 #include <functional> 19 20 #include "common/rs_macros.h" 21 #include "common/rs_rect.h" 22 #include "pipeline/rs_draw_cmd_list.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSRenderResult final { 27 public: 28 #ifndef USE_ROSEN_DRAWING RSRenderResult(const RectI & r,std::shared_ptr<DrawCmdList> dcl)29 RSRenderResult(const RectI& r, std::shared_ptr<DrawCmdList> dcl) : dirty_(r), drawCmdList_(dcl) {} 30 #else 31 RSRenderResult(const RectI& r, std::shared_ptr<Drawing::DrawCmdList> dcl) : dirty_(r), drawCmdList_(dcl) {} 32 #endif 33 ~RSRenderResult() = default; 34 GetDirtyRegion()35 RectI GetDirtyRegion() const 36 { 37 return dirty_; 38 } 39 #ifndef USE_ROSEN_DRAWING GetDrawCmdList()40 std::shared_ptr<DrawCmdList> GetDrawCmdList() const 41 #else 42 std::shared_ptr<Drawing::DrawCmdList> GetDrawCmdList() const 43 #endif 44 { 45 return drawCmdList_; 46 } 47 48 private: 49 RectI dirty_; 50 #ifndef USE_ROSEN_DRAWING 51 std::shared_ptr<DrawCmdList> drawCmdList_; 52 #else 53 std::shared_ptr<Drawing::DrawCmdList> drawCmdList_; 54 #endif 55 }; 56 57 using RenderFinishedCallback = std::function<void(const RSRenderResult&)>; 58 } // namespace Rosen 59 } // namespace OHOS 60 61 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_RESULT_H