ladybird/Libraries/LibWeb/WebGL/OpenGLContext.h
Aliaksandr Kalenik 46cbbda944 LibWeb: Increase SkSurface's generation id when it's modified by WebGL
Skia is not aware of surface modifications done by WebGL, so we need to
manually increase generation id whenver WebGL invokes a writing
function.
2024-12-03 23:35:45 +01:00

40 lines
870 B
C++

/*
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Forward.h>
#include <LibGfx/Size.h>
namespace Web::WebGL {
class OpenGLContext {
public:
static OwnPtr<OpenGLContext> create(NonnullRefPtr<Gfx::SkiaBackendContext>);
void notify_content_will_change();
void clear_buffer_to_default_values();
void allocate_painting_surface_if_needed();
struct Impl;
OpenGLContext(NonnullRefPtr<Gfx::SkiaBackendContext>, Impl);
~OpenGLContext();
void make_current();
void set_size(Gfx::IntSize const&);
RefPtr<Gfx::PaintingSurface> surface();
private:
NonnullRefPtr<Gfx::SkiaBackendContext> m_skia_backend_context;
Gfx::IntSize m_size;
RefPtr<Gfx::PaintingSurface> m_painting_surface;
NonnullOwnPtr<Impl> m_impl;
};
}