1 /* 2 * Copyright (c) 2023 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_COMMON_RS_SURFACE_EXT_H 17 #define RENDER_SERVICE_BASE_COMMON_RS_SURFACE_EXT_H 18 #include <functional> 19 #include <limits> 20 #include <memory> 21 #include <string> 22 #include <unistd.h> 23 24 #include "image/image.h" 25 26 namespace OHOS { 27 // codes only for arkui-x start 28 namespace Rosen { 29 class RSPaintFilterCanvas; 30 class RSSurfaceExt : public std::enable_shared_from_this<RSSurfaceExt> { 31 public: 32 static inline constexpr RSSurfaceExtType Type = RSSurfaceExtType::NONE; GetType()33 RSSurfaceExtType GetType() const 34 { 35 return Type; 36 } 37 RSSurfaceExt() = default; 38 virtual ~RSSurfaceExt() = default; 39 40 RSSurfaceExt(const RSSurfaceExt&) = delete; 41 RSSurfaceExt(const RSSurfaceExt&&) = delete; 42 RSSurfaceExt& operator=(const RSSurfaceExt&) = delete; 43 RSSurfaceExt& operator=(const RSSurfaceExt&&) = delete; 44 45 #ifdef USE_SURFACE_TEXTURE 46 virtual void DrawTextureImage(RSPaintFilterCanvas& canvas, bool freeze, const Drawing::Rect& clipRect) = 0; 47 virtual void UpdateSurfaceDefaultSize(float width, float height) = 0; 48 virtual RSSurfaceExtConfig GetSurfaceExtConfig() = 0; 49 virtual void UpdateSurfaceExtConfig(const RSSurfaceExtConfig& config) = 0; 50 virtual void SetAttachCallback(const RSSurfaceTextureAttachCallBack& attachCallback) = 0; 51 virtual void SetUpdateCallback(const RSSurfaceTextureUpdateCallBack& updateCallback) = 0; 52 virtual void SetInitTypeCallback(const RSSurfaceTextureInitTypeCallBack& initTypeCallback) = 0; 53 virtual void MarkUiFrameAvailable(bool available) = 0; 54 virtual bool IsUiFrameAvailable() const = 0; 55 #endif 56 }; 57 58 #ifdef USE_SURFACE_TEXTURE 59 using RSSurfaceTexture = RSSurfaceExt; 60 #endif 61 } // codes only for arkui-x end 62 } 63 #endif // #define RENDER_SERVICE_BASE_COMMON_RS_SURFACE_EXT_H 64 65