1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. 3 * Description: Draw area manager for vulkan api partial render extended function. 4 * Create: 2023/11/27 5 */ 6 7 #ifndef GrVkDrawAreaManager_DEFINED 8 #define GrVkDrawAreaManager_DEFINED 9 10 #include <map> 11 #include "include/core/SkSurface.h" 12 #include "include/private/SkMutex.h" 13 14 class SK_API GrVkDrawAreaManager { 15 public: getInstance()16 static GrVkDrawAreaManager &getInstance() { 17 static GrVkDrawAreaManager instance; 18 return instance; 19 } 20 21 GrVkDrawAreaManager(const GrVkDrawAreaManager &) = delete; 22 GrVkDrawAreaManager &operator = (const GrVkDrawAreaManager &) = delete; 23 GrVkDrawAreaManager(GrVkDrawAreaManager &&) = delete; 24 GrVkDrawAreaManager &operator = (GrVkDrawAreaManager &&) = delete; 25 26 void bindDrawingArea(SkSurface* surface, const std::vector<SkIRect>& skIRects); 27 28 std::vector<SkIRect>& getDrawingArea(GrRenderTarget* rt); 29 30 void clearSurface(SkSurface* surface); 31 32 void clearAll(); 33 34 private: 35 GrVkDrawAreaManager() = default; 36 virtual ~GrVkDrawAreaManager() = default; 37 38 std::map<GrRenderTarget*, std::vector<SkIRect>> fRtmap; 39 40 SkMutex fMutex; 41 }; 42 #endif