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>
|
|
|
|
|
2023-03-24 20:23:16 +01:00
|
|
|
class CHyprRenderer;
|
|
|
|
|
2022-05-28 17:32:19 +02:00
|
|
|
class CHyprMonitorDebugOverlay {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
|
|
|
int draw(int offset);
|
2022-05-28 17:32:19 +02:00
|
|
|
|
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
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
|
|
|
std::deque<float> m_dLastFrametimes;
|
|
|
|
std::deque<float> m_dLastRenderTimes;
|
|
|
|
std::deque<float> m_dLastRenderTimesNoOverlay;
|
2023-03-03 13:15:59 +01:00
|
|
|
std::deque<float> m_dLastAnimationTicks;
|
2022-05-28 17:32:19 +02:00
|
|
|
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
|
2022-12-16 18:17:31 +01:00
|
|
|
CMonitor* m_pMonitor = nullptr;
|
2023-11-04 18:03:05 +01:00
|
|
|
CBox m_wbLastDrawnBox;
|
2023-03-24 20:23:16 +01:00
|
|
|
|
|
|
|
friend class CHyprRenderer;
|
2022-05-28 17:32:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHyprDebugOverlay {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-05-28 17:32:19 +02:00
|
|
|
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
|
|
|
|
2022-12-16 18:17:31 +01: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
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
cairo_surface_t* m_pCairoSurface = nullptr;
|
|
|
|
cairo_t* m_pCairo = nullptr;
|
2022-05-28 17:32:19 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CTexture m_tTexture;
|
2022-05-28 17:32:19 +02:00
|
|
|
|
|
|
|
friend class CHyprMonitorDebugOverlay;
|
2023-03-24 20:23:16 +01:00
|
|
|
friend class CHyprRenderer;
|
2022-05-28 17:32:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline std::unique_ptr<CHyprDebugOverlay> g_pDebugOverlay;
|