1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:15:09 +00:00
serenity/SharedGraphics/DisjointRectSet.h
Andreas Kling 5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00

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;
};