gl_image_egl_pixmap.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2020 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_IMAGE_EGL_PIXMAP_H_
  5. #define UI_GL_GL_IMAGE_EGL_PIXMAP_H_
  6. #include <stdint.h>
  7. #include "ui/gfx/geometry/size.h"
  8. #include "ui/gfx/x/glx.h"
  9. #include "ui/gl/gl_export.h"
  10. #include "ui/gl/gl_image.h"
  11. typedef void* EGLSurface;
  12. typedef void* EGLDisplay;
  13. namespace gl {
  14. class GL_EXPORT GLImageEGLPixmap : public GLImage {
  15. public:
  16. GLImageEGLPixmap(const gfx::Size& size, gfx::BufferFormat format);
  17. GLImageEGLPixmap(const GLImageEGLPixmap&) = delete;
  18. GLImageEGLPixmap& operator=(const GLImageEGLPixmap&) = delete;
  19. bool Initialize(x11::Pixmap pixmap);
  20. // Overridden from GLImage:
  21. gfx::Size GetSize() override;
  22. unsigned GetInternalFormat() override;
  23. unsigned GetDataType() override;
  24. BindOrCopy ShouldBindOrCopy() override;
  25. bool BindTexImage(unsigned target) override;
  26. void ReleaseTexImage(unsigned target) override;
  27. void Flush() override {}
  28. void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
  29. uint64_t process_tracing_id,
  30. const std::string& dump_name) override;
  31. protected:
  32. ~GLImageEGLPixmap() override;
  33. gfx::BufferFormat format() const { return format_; }
  34. private:
  35. EGLSurface surface_;
  36. const gfx::Size size_;
  37. gfx::BufferFormat format_;
  38. EGLDisplay display_;
  39. };
  40. } // namespace gl
  41. #endif // UI_GL_GL_IMAGE_EGL_PIXMAP_H_