Hyprland/src/debug/HyprDebugOverlay.hpp

47 lines
1.1 KiB
C++
Raw Normal View History

2022-05-28 17:32:19 +02:00
#pragma once
#include "../defines.hpp"
#include "../helpers/Monitor.hpp"
#include "../render/Texture.hpp"
#include <deque>
#include <cairo/cairo.h>
#include <unordered_map>
class CHyprMonitorDebugOverlay {
public:
int draw(int offset);
2022-07-27 12:32:00 +02:00
void renderData(CMonitor* pMonitor, float µs);
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
void frameData(CMonitor* pMonitor);
2022-05-28 17:32:19 +02:00
private:
std::deque<float> m_dLastFrametimes;
std::deque<float> m_dLastRenderTimes;
2022-05-28 17:40:57 +02:00
std::deque<float> m_dLastRenderTimesNoOverlay;
2022-05-28 17:32:19 +02:00
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
2022-07-27 12:32:00 +02:00
CMonitor* m_pMonitor = nullptr;
2022-05-28 17:32:19 +02:00
wlr_box m_wbLastDrawnBox;
};
class CHyprDebugOverlay {
public:
void draw();
2022-07-27 12:32:00 +02:00
void renderData(CMonitor*, float µs);
void renderDataNoOverlay(CMonitor*, float µs);
void frameData(CMonitor*);
2022-05-28 17:32:19 +02:00
private:
2022-07-27 12:32:00 +02:00
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
2022-05-28 17:32:19 +02:00
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
CTexture m_tTexture;
friend class CHyprMonitorDebugOverlay;
};
inline std::unique_ptr<CHyprDebugOverlay> g_pDebugOverlay;