1 /* 2 * Copyright (c) 2024 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 #ifndef RENDER_SERVICE_CORE_PIPELINE_RS_POINTER_WINDOW_MANAGER_H 17 #define RENDER_SERVICE_CORE_PIPELINE_RS_POINTER_WINDOW_MANAGER_H 18 19 #include "params/rs_render_thread_params.h" 20 #include "pipeline/rs_display_render_node.h" 21 #include "pipeline/rs_surface_render_node.h" 22 #include "pipeline/rs_processor_factory.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSPointerWindowManager { 27 public: RSPointerWindowManager()28 RSPointerWindowManager() {} 29 ~RSPointerWindowManager() = default; 30 31 static RSPointerWindowManager& Instance(); 32 33 void UpdatePointerDirtyToGlobalDirty(std::shared_ptr<RSSurfaceRenderNode>& pointWindow, 34 std::shared_ptr<RSDisplayRenderNode>& curDisplayNode); 35 IsNeedForceCommitByPointer()36 bool IsNeedForceCommitByPointer() const 37 { 38 return isNeedForceCommitByPointer_; 39 } 40 SetNeedForceCommitByPointer(bool isNeedForceCommitByPointer)41 void SetNeedForceCommitByPointer(bool isNeedForceCommitByPointer) 42 { 43 isNeedForceCommitByPointer_ = isNeedForceCommitByPointer; 44 } 45 CollectInfoForHardCursor(NodeId id,DrawableV2::RSRenderNodeDrawableAdapter::SharedPtr cursorDrawable)46 void CollectInfoForHardCursor(NodeId id, 47 DrawableV2::RSRenderNodeDrawableAdapter::SharedPtr cursorDrawable) 48 { 49 hardCursorDrawables_.id = id; 50 hardCursorDrawables_.drawablePtr = cursorDrawable; 51 } 52 GetHardCursorDrawables()53 const HardCursorInfo& GetHardCursorDrawables() const 54 { 55 return hardCursorDrawables_; 56 } 57 ResetHardCursorDrawables()58 void ResetHardCursorDrawables() 59 { 60 hardCursorDrawables_.id = INVALID_NODEID; 61 hardCursorDrawables_.drawablePtr = nullptr; 62 hardCursorNodes_ = nullptr; 63 } 64 65 void SetHardCursorNodeInfo(std::shared_ptr<RSSurfaceRenderNode> hardCursorNode); 66 const std::shared_ptr<RSSurfaceRenderNode>& GetHardCursorNode() const; 67 68 void HardCursorCreateLayerForDirect(std::shared_ptr<RSProcessor> processor); 69 70 bool CheckHardCursorSupport(std::shared_ptr<RSDisplayRenderNode>& curDisplayNode); 71 bool HasMirrorDisplay() const; 72 73 private: 74 bool isNeedForceCommitByPointer_{ false }; 75 HardCursorInfo hardCursorDrawables_; 76 std::shared_ptr<RSSurfaceRenderNode> hardCursorNodes_; 77 }; 78 } // namespace Rosen 79 } // namespace OHOS 80 #endif // RENDER_SERVICE_CORE_PIPELINE_RS_POINTER_WINDOW_MANAGER_H