1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:27:35 +00:00

LibAccelGfx+WebContent: Introduce Canvas that represents framebuffer

This commit is contained in:
Aliaksandr Kalenik 2023-11-22 14:33:37 +01:00 committed by Andreas Kling
parent c03b69e664
commit d5630fedf1
4 changed files with 84 additions and 26 deletions

View file

@ -10,6 +10,7 @@
#include <AK/HashMap.h>
#include <AK/Noncopyable.h>
#include <AK/Vector.h>
#include <LibAccelGfx/Canvas.h>
#include <LibAccelGfx/Context.h>
#include <LibAccelGfx/Forward.h>
#include <LibAccelGfx/GL.h>
@ -72,8 +73,8 @@ public:
void set_clip_rect(Gfx::IntRect);
void clear_clip_rect();
void set_target_bitmap(Gfx::Bitmap&);
void flush();
void set_target_canvas(NonnullRefPtr<Canvas>);
void flush(Gfx::Bitmap&);
void fill_rect_with_linear_gradient(Gfx::IntRect const&, ReadonlySpan<Gfx::ColorStop>, float angle, Optional<float> repeat_length = {});
void fill_rect_with_linear_gradient(Gfx::FloatRect const&, ReadonlySpan<Gfx::ColorStop>, float angle, Optional<float> repeat_length = {});
@ -95,10 +96,14 @@ private:
[[nodiscard]] State& state() { return m_state_stack.last(); }
[[nodiscard]] State const& state() const { return m_state_stack.last(); }
void bind_target_canvas();
[[nodiscard]] Gfx::FloatRect to_clip_space(Gfx::FloatRect const& screen_rect) const;
Vector<State, 1> m_state_stack;
RefPtr<Canvas> m_target_canvas;
Program m_rectangle_program;
Program m_rounded_rectangle_program;
Program m_blit_program;
@ -107,9 +112,6 @@ private:
HashMap<GlyphsTextureKey, Gfx::IntRect> m_glyphs_texture_map;
Gfx::IntSize m_glyphs_texture_size;
GL::Texture m_glyphs_texture;
Optional<Gfx::Bitmap&> m_target_bitmap;
Optional<GL::Framebuffer> m_target_framebuffer;
};
}