mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:15:09 +00:00

Some of these are less helpful than others. Avoiding a bunch of mallocs in the event loop wakeup code is definitely nice.
23 lines
496 B
C++
23 lines
496 B
C++
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <SharedGraphics/Rect.h>
|
|
|
|
class DisjointRectSet {
|
|
public:
|
|
DisjointRectSet() { }
|
|
~DisjointRectSet() { }
|
|
DisjointRectSet(DisjointRectSet&& other) : m_rects(move(other.m_rects)) { }
|
|
|
|
void add(const Rect&);
|
|
|
|
void clear() { m_rects.clear(); }
|
|
void clear_with_capacity() { m_rects.clear_with_capacity(); }
|
|
const Vector<Rect, 32>& rects() const { return m_rects; }
|
|
|
|
private:
|
|
void shatter();
|
|
|
|
Vector<Rect, 32> m_rects;
|
|
};
|
|
|