1 /* 2 * Copyright (c) 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 SURFACE_FRAME_OHOS_RASTER_H 17 #define SURFACE_FRAME_OHOS_RASTER_H 18 19 #include <surface.h> 20 #include "surface_type.h" 21 #include "surface_frame.h" 22 #include "surface_frame_ohos.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class SurfaceFrameOhosRaster : public SurfaceFrameOhos { 27 public: 28 SurfaceFrameOhosRaster(int32_t width, int32_t height); 29 ~SurfaceFrameOhosRaster() override; 30 void SetDamageRegion(int32_t left, int32_t top, int32_t width, int32_t height) override; 31 void SetColorSpace(GraphicColorGamut colorSpace) override; 32 GraphicColorGamut GetColorSpace() const override; 33 friend class SurfaceOhosRaster; GetBuffer()34 sptr<SurfaceBuffer> GetBuffer() const 35 { 36 return buffer_; 37 } 38 private: 39 sptr<SurfaceBuffer> buffer_; 40 BufferRequestConfig requestConfig_ = { 41 .width = 0x100, 42 .height = 0x100, 43 .strideAlignment = 0x8, 44 .format = GRAPHIC_PIXEL_FMT_RGBA_8888, 45 .usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA, 46 .timeout = 0, 47 }; 48 49 BufferFlushConfig flushConfig_ = { 50 .damage = { 51 .x = 0, 52 .y = 0, 53 .w = 0x100, 54 .h = 0x100, 55 }, 56 }; 57 GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB; 58 }; 59 } // namespace Rosen 60 } // namespace OHOS 61 62 #endif