• 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 VULKAN_RENDER_BACKEND_H
17 #define VULKAN_RENDER_BACKEND_H
18 
19 #include "include/core/SkCanvas.h"
20 #include "include/core/SkColorSpace.h"
21 #include "include/core/SkImageInfo.h"
22 #include "include/core/SkSurface.h"
23 #include "include/gpu/GrBackendSurface.h"
24 #include "include/gpu/GrContextOptions.h"
25 #ifdef USE_M133_SKIA
26 #include "include/gpu/ganesh/GrDirectContext.h"
27 #else
28 #include "include/gpu/GrDirectContext.h"
29 #endif
30 #include "interface_render_backend.h"
31 
32 namespace OHOS {
33 namespace Rosen {
34 class VulkanRenderBackend : public IRenderBackend {
35 public:
36     VulkanRenderBackend() noexcept = default;
37     ~VulkanRenderBackend() override = default;
InitDrawContext()38     void InitDrawContext() override {}
MakeCurrent()39     void MakeCurrent() override {}
SwapBuffers()40     void SwapBuffers() override {}
CreateSurface(void * window)41     void* CreateSurface(void* window) override {return nullptr;}
SetDamageRegion(int32_t left,int32_t top,int32_t width,int32_t height)42     void SetDamageRegion(int32_t left, int32_t top, int32_t width, int32_t height) override {}
GetGrContext()43     GrDirectContext* GetGrContext() const
44     {
45         return grContext_.get();
46     }
SetUpGrContext()47     bool SetUpGrContext() {return true;}
48     void Destroy() override;
49     void RenderFrame() override;
50     SkCanvas* AcquireSkCanvas(std::unique_ptr<SurfaceFrame>& frame) override;
51     Drawing::Canvas* AcquireDrCanvas(std::unique_ptr<SurfaceFrame>& frame) override;
52 private:
53     sk_sp<GrDirectContext> grContext_ = nullptr;
54     SkSurface* skSurface_ = nullptr;
55     Drawing::Surface* drSurface_ = nullptr;
56 };
57 }
58 }
59 #endif