gl_image_glx.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2012 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_GLX_H_
  5. #define UI_GL_GL_IMAGE_GLX_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. namespace gl {
  12. class GL_EXPORT GLImageGLX : public GLImage {
  13. public:
  14. GLImageGLX(const gfx::Size& size, gfx::BufferFormat format);
  15. GLImageGLX(const GLImageGLX&) = delete;
  16. GLImageGLX& operator=(const GLImageGLX&) = delete;
  17. bool Initialize(x11::Pixmap pixmap);
  18. // Overridden from GLImage:
  19. gfx::Size GetSize() override;
  20. unsigned GetInternalFormat() override;
  21. unsigned GetDataType() override;
  22. BindOrCopy ShouldBindOrCopy() override;
  23. bool BindTexImage(unsigned target) override;
  24. void ReleaseTexImage(unsigned target) override;
  25. bool CopyTexImage(unsigned target) override;
  26. bool CopyTexSubImage(unsigned target,
  27. const gfx::Point& offset,
  28. const gfx::Rect& rect) override;
  29. void Flush() override {}
  30. void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
  31. uint64_t process_tracing_id,
  32. const std::string& dump_name) override;
  33. protected:
  34. ~GLImageGLX() override;
  35. gfx::BufferFormat format() const { return format_; }
  36. private:
  37. uint32_t glx_pixmap_;
  38. const gfx::Size size_;
  39. gfx::BufferFormat format_;
  40. };
  41. } // namespace gl
  42. #endif // UI_GL_GL_IMAGE_GLX_H_