OpenGLContext.h 870 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/Forward.h>
  8. #include <LibGfx/Size.h>
  9. namespace Web::WebGL {
  10. class OpenGLContext {
  11. public:
  12. static OwnPtr<OpenGLContext> create(NonnullRefPtr<Gfx::SkiaBackendContext>);
  13. void notify_content_will_change();
  14. void clear_buffer_to_default_values();
  15. void allocate_painting_surface_if_needed();
  16. struct Impl;
  17. OpenGLContext(NonnullRefPtr<Gfx::SkiaBackendContext>, Impl);
  18. ~OpenGLContext();
  19. void make_current();
  20. void set_size(Gfx::IntSize const&);
  21. RefPtr<Gfx::PaintingSurface> surface();
  22. private:
  23. NonnullRefPtr<Gfx::SkiaBackendContext> m_skia_backend_context;
  24. Gfx::IntSize m_size;
  25. RefPtr<Gfx::PaintingSurface> m_painting_surface;
  26. NonnullOwnPtr<Impl> m_impl;
  27. };
  28. }