• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
18 
19 #include <cstdint>
20 #include <stdint.h>
21 
22 #include "base/memory/ace_type.h"
23 #include "base/utils/noncopyable.h"
24 #include "core/components_ng/render/ext_surface_callback_interface.h"
25 #include "core/components_ng/render/render_context.h"
26 
27 namespace OHOS::Ace::NG {
28 // RenderSurface is used for SurfaceNode
29 class RenderSurface : public virtual AceType {
30     DECLARE_ACE_TYPE(NG::RenderSurface, AceType)
31 
32 public:
33     ~RenderSurface() override = default;
34 
35     static RefPtr<RenderSurface> Create();
36 
InitSurface()37     virtual void InitSurface() {}
38 
UpdateXComponentConfig()39     virtual void UpdateXComponentConfig() {}
40 
GetNativeWindow()41     virtual void* GetNativeWindow()
42     {
43         return nullptr;
44     }
45 
SetRenderContext(const RefPtr<RenderContext> & renderContext)46     virtual void SetRenderContext(const RefPtr<RenderContext>& renderContext) {};
47 
ConfigSurface(uint32_t surfaceWidth,uint32_t surfaceHeight)48     virtual void ConfigSurface(uint32_t surfaceWidth, uint32_t surfaceHeight) {};
49 
IsSurfaceValid()50     virtual bool IsSurfaceValid() const
51     {
52         return false;
53     }
54 
CreateNativeWindow()55     virtual void CreateNativeWindow() {};
56 
AdjustNativeWindowSize(uint32_t width,uint32_t height)57     virtual void AdjustNativeWindowSize(uint32_t width, uint32_t height) {}
58 
GetUniqueId()59     virtual std::string GetUniqueId() const
60     {
61         return "";
62     }
63 
SetExtSurfaceBounds(int32_t left,int32_t top,int32_t width,int32_t height)64     virtual void SetExtSurfaceBounds(int32_t left, int32_t top, int32_t width, int32_t height) {}
65 
SetExtSurfaceCallback(const RefPtr<ExtSurfaceCallbackInterface> & extSurfaceCallback)66     virtual void SetExtSurfaceCallback(const RefPtr<ExtSurfaceCallbackInterface>& extSurfaceCallback) {}
67 
68 protected:
69     RenderSurface() = default;
70 
71     ACE_DISALLOW_COPY_AND_MOVE(RenderSurface);
72 };
73 } // namespace OHOS::Ace::NG
74 
75 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
76