summaryrefslogtreecommitdiffstats
path: root/src/core/ozone/surface_factory_qt.h
blob: 07d7337ac5b79144167e5c0703f7b98b28b9c0f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef SURFACE_FACTORY_QT
#define SURFACE_FACTORY_QT

#if defined(USE_OZONE)

#include "ui/ozone/public/surface_factory_ozone.h"

namespace QtWebEngineCore {

class SurfaceFactoryQt : public ui::SurfaceFactoryOzone
{
public:
    SurfaceFactoryQt();
    std::vector<gl::GLImplementationParts> GetAllowedGLImplementations() override;
    ui::GLOzone *GetGLOzone(const gl::GLImplementationParts &implementation) override;
#if BUILDFLAG(ENABLE_VULKAN)
    std::unique_ptr<gpu::VulkanImplementation>
    CreateVulkanImplementation(bool allow_protected_memory, bool enforce_protected_memory) override;
#endif
    bool CanCreateNativePixmapForFormat(gfx::BufferFormat format) override;
    scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
        gfx::AcceleratedWidget widget,
        gpu::VulkanDeviceQueue* device_queue,
        gfx::Size size,
        gfx::BufferFormat format,
        gfx::BufferUsage usage,
        absl::optional<gfx::Size> framebuffer_size = absl::nullopt) override;
    void CreateNativePixmapAsync(gfx::AcceleratedWidget widget,
                                 gpu::VulkanDeviceQueue* device_queue,
                                 gfx::Size size,
                                 gfx::BufferFormat format,
                                 gfx::BufferUsage usage,
                                 NativePixmapCallback callback) override;
    scoped_refptr<gfx::NativePixmap> CreateNativePixmapFromHandle(
        gfx::AcceleratedWidget widget,
        gfx::Size size,
        gfx::BufferFormat format,
        gfx::NativePixmapHandle handle) override;

    bool SupportsNativePixmaps() const;

private:
    std::vector<gl::GLImplementationParts> m_impl;
    std::unique_ptr<ui::GLOzone> m_ozone;
};

} // namespace QtWebEngineCore

#endif // defined(USE_OZONE)

#endif // SURFACE_FACTORY_QT