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 "iconsumer_surface.h" 20 #include "surface.h" 21 #include "pipeline/rs_base_render_util.h" 22 #include "pipeline/rs_render_service_listener.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 27 class RSTestUtil { 28 public: 29 static std::shared_ptr<RSSurfaceRenderNode> CreateSurfaceNode(); 30 static std::shared_ptr<RSSurfaceRenderNode> CreateSurfaceNodeWithBuffer(); 31 static void InitRenderNodeGC(); 32 private: 33 static inline BufferRequestConfig requestConfig = { 34 .width = 0x100, 35 .height = 0x100, 36 .strideAlignment = 0x8, 37 .format = GRAPHIC_PIXEL_FMT_RGBA_8888, 38 .usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA, 39 .timeout = 0, 40 }; 41 static inline BufferFlushConfig flushConfig = { 42 .damage = { .w = 0x100, .h = 0x100, }, 43 }; 44 static inline sptr<IConsumerSurface> csurf = nullptr; 45 static inline sptr<IBufferProducer> producer = nullptr; 46 static inline sptr<Surface> psurf = nullptr; 47 static NodeId id; 48 }; 49 } // namespace ROSEN 50 } // namespace OHOS 51 #endif // RS_TEST_UTIL_H 52