1 /* 2 * Copyright (c) 2021 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 RENDER_SERVICE_BASE_PLATFORM_RS_SURFACE_OHOS_H 17 #define RENDER_SERVICE_BASE_PLATFORM_RS_SURFACE_OHOS_H 18 19 #include <surface.h> 20 21 #include "platform/drawing/rs_surface.h" 22 #include "render_context/render_context.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSSurfaceOhos : public RSSurface { 27 public: RSSurfaceOhos(const sptr<Surface> & producer)28 RSSurfaceOhos(const sptr<Surface>& producer) : producer_(producer) 29 { 30 producer_->SetQueueSize(5); // set buffer queue size to 5 31 } 32 GetSurface()33 sptr<Surface> GetSurface() const 34 { 35 return producer_; 36 } 37 38 virtual RenderContext* GetRenderContext() override; 39 virtual void SetRenderContext(RenderContext* context) override; 40 virtual void SetColorSpace(SurfaceColorGamut colorSpace) override; 41 virtual SurfaceColorGamut GetColorSpace() override; 42 protected: 43 sptr<Surface> producer_; 44 RenderContext* context_ = nullptr; 45 SurfaceColorGamut colorSpace_ = SurfaceColorGamut::COLOR_GAMUT_SRGB; 46 }; 47 48 } // namespace Rosen 49 } // namespace OHOS 50 51 #endif // RENDER_SERVICE_BASE_PLATFORM_RS_SURFACE_OHOS_H 52