• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace Rosen {
28 class RSPaintFilterCanvas;
29 class RSSurfaceExt : public std::enable_shared_from_this<RSSurfaceExt> {
30 public:
31     static inline constexpr RSSurfaceExtType Type = RSSurfaceExtType::NONE;
GetType()32     RSSurfaceExtType GetType() const
33     {
34         return Type;
35     }
36     RSSurfaceExt() = default;
37     virtual ~RSSurfaceExt() = default;
38 
39     RSSurfaceExt(const RSSurfaceExt&) = delete;
40     RSSurfaceExt(const RSSurfaceExt&&) = delete;
41     RSSurfaceExt& operator=(const RSSurfaceExt&) = delete;
42     RSSurfaceExt& operator=(const RSSurfaceExt&&) = delete;
43 
44 #ifdef USE_SURFACE_TEXTURE
45     virtual void DrawTextureImage(RSPaintFilterCanvas& canvas, bool freeze, const Drawing::Rect& clipRect) = 0;
46     virtual void UpdateSurfaceDefaultSize(float width, float height) = 0;
47     virtual void SetAttachCallback(const RSSurfaceTextureAttachCallBack& attachCallback) = 0;
48     virtual void SetUpdateCallback(const RSSurfaceTextureUpdateCallBack& updateCallback) = 0;
49     virtual void MarkUiFrameAvailable(bool available) = 0;
50     virtual bool IsUiFrameAvailable() const = 0;
51 #endif
52 };
53 
54 #ifdef USE_SURFACE_TEXTURE
55 using RSSurfaceTexture = RSSurfaceExt;
56 #endif
57 }
58 }
59 #endif // #define RENDER_SERVICE_BASE_COMMON_RS_SURFACE_EXT_H
60 
61