• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #ifndef OHOS_ROSEN_FREEZE_CONTROLLER_H
17 #define OHOS_ROSEN_FREEZE_CONTROLLER_H
18 
19 #include <refbase.h>
20 
21 #include <include/core/SkBitmap.h>
22 #include <pixel_map.h>
23 #ifdef ACE_ENABLE_GL
24 #include <render_context/render_context.h>
25 #endif
26 #include <transaction/rs_transaction.h>
27 #include <ui/rs_surface_extractor.h>
28 
29 #include "display.h"
30 #include "window.h"
31 
32 namespace OHOS {
33 namespace Rosen {
34 class FreezeController : public RefBase {
35 public:
FreezeController()36     FreezeController() {};
37     ~FreezeController() = default;
38 
39     bool FreezeDisplay(DisplayId displayId);
40     bool UnfreezeDisplay(DisplayId displayId);
41 
42 private:
43     sptr<Window> CreateCoverWindow(DisplayId displayId);
44     SkImageInfo MakeSkImageInfoFromPixelMap(std::shared_ptr<Media::PixelMap>& pixmap);
45     bool DrawSkImage(std::shared_ptr<RSSurface>& rsSurface,
46         uint32_t width, uint32_t height, std::shared_ptr<Media::PixelMap> pixelMap);
47 
48     std::map<DisplayId, sptr<Window>> coverWindowMap_;
49 #ifdef ACE_ENABLE_GL
50     RenderContext* rc_ = nullptr;
51 #endif
52 };
53 }
54 }
55 #endif // OHOS_ROSEN_FREEZE_CONTROLLER_H
56 
57