diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-16 13:57:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-16 13:57:27 +0100 |
| commit | ed349e84d26f35a6ef20019f7315ddfd85d1e7ee (patch) | |
| tree | cc5f7dfa218c6472399a7b2931b6b73254bc7099 /src/debug/HyprNotificationOverlay.hpp | |
| parent | e6c5040f417001fc3cf20e21f971f926626a0f6f (diff) | |
notifications: optimize rendering (#14088)
drop cairo, use proper gpu rendering
Diffstat (limited to 'src/debug/HyprNotificationOverlay.hpp')
| -rw-r--r-- | src/debug/HyprNotificationOverlay.hpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp index c2ecbfe0..e8cbf56a 100644 --- a/src/debug/HyprNotificationOverlay.hpp +++ b/src/debug/HyprNotificationOverlay.hpp @@ -7,8 +7,6 @@ #include <vector> -#include <cairo/cairo.h> - enum eIconBackend : uint8_t { ICONS_BACKEND_NONE = 0, ICONS_BACKEND_NF, @@ -27,6 +25,19 @@ static const std::array<CHyprColor, ICON_NONE + 1> ICONS_COLORS = {CHyprColor{1. CHyprColor{0, 0, 0, 1.0}}; struct SNotification { + struct SRenderCache { + SP<Render::ITexture> textTex; + SP<Render::ITexture> iconTex; + + Vector2D textSize = {}; + Vector2D iconSize = {}; + + PHLMONITORREF monitor; + std::string fontFamily; + int fontSizePx = -1; + eIconBackend iconBackend = ICONS_BACKEND_NONE; + } cache; + std::string text = ""; CHyprColor color; CTimer started; @@ -46,18 +57,16 @@ class CHyprNotificationOverlay { bool hasAny(); private: + void ensureNotificationCache(SNotification& notif, PHLMONITOR pMonitor, const std::string& fontFamily); + eIconBackend iconBackendForFont(const std::string& fontFamily); CBox drawNotifications(PHLMONITOR pMonitor); CBox m_lastDamage; std::vector<UP<SNotification>> m_notifications; - cairo_surface_t* m_cairoSurface = nullptr; - cairo_t* m_cairo = nullptr; - - PHLMONITORREF m_lastMonitor; - Vector2D m_lastSize = Vector2D(-1, -1); - - SP<Render::ITexture> m_texture; + std::string m_cachedIconBackendFontFamily; + eIconBackend m_cachedIconBackend = ICONS_BACKEND_NONE; + bool m_iconBackendValid = false; }; inline UP<CHyprNotificationOverlay> g_pHyprNotificationOverlay; |
