mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +00:00
LibAccelGfx+LibWeb: Add support for stacking context opacity
For each stacking context with an opacity less than 1, we create a separate framebuffer. We then blit the texture attached to this framebuffer with the specified opacity. To avoid the performance overhead of reading pixels from the texture into Gfx::Bitmap, a new method that allows for direct blitting from the texture is introduced, named blit_scaled_texture().
This commit is contained in:
parent
cb90daadc7
commit
5f7ac559a7
8 changed files with 133 additions and 74 deletions
|
@ -29,6 +29,7 @@ class Painter {
|
|||
|
||||
public:
|
||||
static OwnPtr<Painter> create();
|
||||
static OwnPtr<Painter> create_with_glyphs_texture_from_painter(Painter const& painter);
|
||||
|
||||
Painter(Context&);
|
||||
~Painter();
|
||||
|
@ -86,6 +87,9 @@ public:
|
|||
void fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color const& color, CornerRadius const& top_left_radius, CornerRadius const& top_right_radius, CornerRadius const& bottom_left_radius, CornerRadius const& bottom_right_radius);
|
||||
void fill_rect_with_rounded_corners(Gfx::FloatRect const& rect, Color const& color, CornerRadius const& top_left_radius, CornerRadius const& top_right_radius, CornerRadius const& bottom_left_radius, CornerRadius const& bottom_right_radius);
|
||||
|
||||
void blit_canvas(Gfx::IntRect const& dst_rect, Canvas const&, float opacity = 1.0f);
|
||||
void blit_canvas(Gfx::FloatRect const& dst_rect, Canvas const&, float opacity = 1.0f);
|
||||
|
||||
private:
|
||||
Context& m_context;
|
||||
|
||||
|
@ -96,6 +100,7 @@ private:
|
|||
[[nodiscard]] State& state() { return m_state_stack.last(); }
|
||||
[[nodiscard]] State const& state() const { return m_state_stack.last(); }
|
||||
|
||||
void blit_scaled_texture(Gfx::FloatRect const& dst_rect, GL::Texture const&, Gfx::FloatRect const& src_rect, ScalingMode, float opacity = 1.0f);
|
||||
void bind_target_canvas();
|
||||
|
||||
[[nodiscard]] Gfx::FloatRect to_clip_space(Gfx::FloatRect const& screen_rect) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue