ladybird/SharedGraphics/DisjointRectSet.h
Robin Burchell 9b86eb9fad WSCompositor: Allow a compose to bypass the timer when it first happens
d66fa60fcf introduced the use of a timer
to coalesce screen updates. This is OK, but it does introduce update
latency.

To help mitigate the impact of this, we now have a second (immediate)
timer. When a compose pass is first triggered, the immediate timer will
allow the compose to happen on the next spin of the event loop (so, only
coalescing updates across a single event loop pass). Any updates that
trigger while the delayed timer is running, though, will be delayed to
that (~60fps) timer.

This fixes #103.
2019-05-26 18:22:33 +02:00

26 lines
602 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&);
bool is_empty() const { return m_rects.is_empty(); }
int size() const { return m_rects.size(); }
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;
};