gl_surface_egl_x11_gles2.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (c) 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_SURFACE_EGL_X11_GLES2_H_
  5. #define UI_GL_GL_SURFACE_EGL_X11_GLES2_H_
  6. #include <stdint.h>
  7. #include "ui/gfx/x/event.h"
  8. #include "ui/gl/gl_export.h"
  9. #include "ui/gl/gl_surface_egl_x11.h"
  10. namespace gl {
  11. // Encapsulates an EGL surface bound to a view using the X Window System.
  12. class GL_EXPORT NativeViewGLSurfaceEGLX11GLES2
  13. : public NativeViewGLSurfaceEGLX11 {
  14. public:
  15. explicit NativeViewGLSurfaceEGLX11GLES2(gl::GLDisplayEGL* display,
  16. x11::Window window);
  17. NativeViewGLSurfaceEGLX11GLES2(const NativeViewGLSurfaceEGLX11GLES2&) =
  18. delete;
  19. NativeViewGLSurfaceEGLX11GLES2& operator=(
  20. const NativeViewGLSurfaceEGLX11GLES2&) = delete;
  21. // NativeViewGLSurfaceEGL overrides.
  22. EGLConfig GetConfig() override;
  23. void Destroy() override;
  24. bool Resize(const gfx::Size& size,
  25. float scale_factor,
  26. const gfx::ColorSpace& color_space,
  27. bool has_alpha) override;
  28. bool InitializeNativeWindow() override;
  29. protected:
  30. ~NativeViewGLSurfaceEGLX11GLES2() override;
  31. x11::Window window() const { return static_cast<x11::Window>(window_); }
  32. void set_window(x11::Window window) {
  33. window_ = static_cast<uint32_t>(window);
  34. }
  35. private:
  36. // x11::EventObserver:
  37. void OnEvent(const x11::Event& xev) override;
  38. x11::Window parent_window_;
  39. };
  40. } // namespace gl
  41. #endif // UI_GL_GL_SURFACE_EGL_X11_GLES2_H_