forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gl_display_egl_util.h
47 lines (36 loc) · 1.63 KB
/
gl_display_egl_util.h
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
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GL_GL_DISPLAY_EGL_UTIL_H_
#define UI_GL_GL_DISPLAY_EGL_UTIL_H_
#include <vector>
#include "third_party/khronos/EGL/egl.h"
#include "ui/gl/gl_export.h"
#include "ui/gl/gl_surface_egl.h"
namespace gl {
// Utility singleton class that helps to set additional egl properties. This
// class should be implemented by each platform except Ozone. In case of Ozone,
// there is a common implementation that forwards calls to a public interface of
// a platform.
// The reason why it is defined here in ui/gl is that ui/gl cannot depend on
// ozone and we have to provide an interface here. ui/gl/init will provide an
// implementation for this utility class upon initialization of gl.
class GL_EXPORT GLDisplayEglUtil {
public:
// Returns either set instance or stub instance.
static GLDisplayEglUtil* GetInstance();
static void SetInstance(GLDisplayEglUtil* gl_display_util);
// Returns display attributes for the given |platform_type|. Each platform can
// have different attributes.
virtual void GetPlatformExtraDisplayAttribs(
EGLenum platform_type,
std::vector<EGLAttrib>* attributes) = 0;
// Sets custom alpha and buffer size for a given platform. By default, the
// values are not modified.
virtual void ChoosePlatformCustomAlphaAndBufferSize(EGLint* alpha_size,
EGLint* buffer_size) = 0;
protected:
virtual ~GLDisplayEglUtil() = default;
};
} // namespace gl
#endif // UI_GL_GL_DISPLAY_EGL_UTIL_H_