• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 RS_TEST_UTIL_H
17 #define RS_TEST_UTIL_H
18 
19 #include "feature/round_corner_display/rs_rcd_surface_render_node.h"
20 #include "iconsumer_surface.h"
21 #include "pipeline/render_thread/rs_base_render_util.h"
22 #include "pipeline/main_thread/rs_render_service_listener.h"
23 #include "surface.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 
28 class RSTestUtil {
29 public:
30     static std::shared_ptr<RSSurfaceRenderNode> CreateSurfaceNode(const RSSurfaceRenderNodeConfig surfaceConfig = {});
31     static std::shared_ptr<RSSurfaceRenderNode> CreateSurfaceNodeWithBuffer();
32     static std::shared_ptr<RSRcdSurfaceRenderNode> CreateRcdNodeWithBuffer();
33     static void InitRenderNodeGC();
34 private:
35     static inline BufferRequestConfig requestConfig = {
36         .width = 0x100,
37         .height = 0x100,
38         .strideAlignment = 0x8,
39         .format = GRAPHIC_PIXEL_FMT_RGBA_8888,
40         .usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA,
41         .timeout = 0,
42     };
43     static inline BufferFlushConfig flushConfig = {
44         .damage = { .w = 0x100, .h = 0x100, },
45     };
46     static inline sptr<IConsumerSurface> csurf = nullptr;
47     static inline sptr<IBufferProducer> producer = nullptr;
48     static inline sptr<Surface> psurf = nullptr;
49     static NodeId id;
50 };
51 } // namespace ROSEN
52 } // namespace OHOS
53 #endif // RS_TEST_UTIL_H
54