1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibAccelGfx+LibWeb: Implement draw_scaled_bitmap()

Very basic implementation of command to paint bitmap. In the future we
should reuse loaded textures across repaints whenever it is possible.
This commit is contained in:
Aliaksandr Kalenik 2023-11-02 01:18:07 +01:00 committed by Andreas Kling
parent b7f8d7e357
commit aa6c008450
3 changed files with 110 additions and 2 deletions

View file

@ -37,6 +37,14 @@ public:
void fill_rect(Gfx::FloatRect, Gfx::Color);
void fill_rect(Gfx::IntRect, Gfx::Color);
enum class ScalingMode {
NearestNeighbor,
Bilinear,
};
void draw_scaled_bitmap(Gfx::FloatRect const& dst_rect, Gfx::Bitmap const&, Gfx::FloatRect const& src_rect, ScalingMode = ScalingMode::NearestNeighbor);
void draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const&, Gfx::IntRect const& src_rect, ScalingMode = ScalingMode::NearestNeighbor);
void set_canvas(Canvas& canvas) { m_canvas = canvas; }
void flush();
@ -56,6 +64,7 @@ private:
Vector<State, 1> m_state_stack;
Program m_rectangle_program;
Program m_blit_program;
};
}