Hyprland/src/debug/HyprDebugOverlay.hpp

52 lines
1.6 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 CHyprRenderer;
2022-05-28 17:32:19 +02:00
class CHyprMonitorDebugOverlay {
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
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;
CMonitor* m_pMonitor = nullptr;
CBox m_wbLastDrawnBox;
friend class CHyprRenderer;
2022-05-28 17:32:19 +02:00
};
class CHyprDebugOverlay {
public:
CHyprDebugOverlay();
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
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;
2022-05-28 17:32:19 +02:00
SP<CTexture> m_pTexture;
2022-05-28 17:32:19 +02:00
friend class CHyprMonitorDebugOverlay;
friend class CHyprRenderer;
2022-05-28 17:32:19 +02:00
};
inline std::unique_ptr<CHyprDebugOverlay> g_pDebugOverlay;