summaryrefslogtreecommitdiffstats
path: root/src/core/ozone/gl_surface_wgl_qt.cpp
blob: db4aed8846164b590b33063755b8e32965b89be5 (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
56
57
58
59
60
// Copyright (C) 2018 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

#include "gl_surface_wgl_qt.h"

#if BUILDFLAG(IS_WIN)
#include "ui/gl/gl_display_manager.h"
#include "ui/gl/gl_surface_wgl.h"

namespace gl {

GLSurfaceWGLQt::GLSurfaceWGLQt(const gfx::Size& size)
    : GLSurfaceQt(size),
      m_surfaceBuffer(nullptr)
{
}

GLSurfaceWGLQt::~GLSurfaceWGLQt()
{
    Destroy();
}

gl::GLDisplay *GLSurfaceWGLQt::InitializeOneOff(gl::GpuPreference gpu_preference)
{
    if (GLSurfaceWGL::InitializeOneOff())
        return GLDisplayManagerWGL::GetInstance()->GetDisplay(gpu_preference);

    return nullptr;
}

bool GLSurfaceWGLQt::Initialize(GLSurfaceFormat format)
{
    m_surfaceBuffer = new PbufferGLSurfaceWGL(m_size);
    m_format = format;
    return m_surfaceBuffer->Initialize(format);
}

void GLSurfaceWGLQt::Destroy()
{
    m_surfaceBuffer = nullptr;
}

void *GLSurfaceWGLQt::GetHandle()
{
    return m_surfaceBuffer->GetHandle();
}

GLDisplay *GLSurfaceWGLQt::GetGLDisplay()
{
    return m_surfaceBuffer->GetGLDisplay();
}

void *GLSurfaceWGLQt::GetConfig()
{
    return m_surfaceBuffer->GetConfig();
}

} //namespace gl

#endif // BUILDFLAG(IS_WIN)