mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:18:11 +00:00
LibWeb: Factor out OccupationGrid functions
Clean up the code by using an OccupationGrid class. This was a neat idea proposed by MacDue.
This commit is contained in:
parent
db19570b94
commit
a764e43db3
2 changed files with 98 additions and 69 deletions
|
@ -27,4 +27,21 @@ private:
|
|||
bool is_auto_positioned_track(CSS::GridTrackPlacement const&, CSS::GridTrackPlacement const&) const;
|
||||
};
|
||||
|
||||
class OccupationGrid {
|
||||
public:
|
||||
OccupationGrid(int column_count, int row_count);
|
||||
|
||||
void maybe_add_column(int needed_number_of_columns);
|
||||
void maybe_add_row(int needed_number_of_rows);
|
||||
void set_occupied(int column_start, int column_end, int row_start, int row_end);
|
||||
void set_occupied(int column_index, int row_index);
|
||||
|
||||
int column_count() { return static_cast<int>(m_occupation_grid[0].size()); }
|
||||
int row_count() { return static_cast<int>(m_occupation_grid.size()); }
|
||||
bool is_occupied(int column_index, int row_index);
|
||||
|
||||
private:
|
||||
Vector<Vector<bool>> m_occupation_grid;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue