mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 05:49:48 +01:00
move monitor damage to separate funcs
This commit is contained in:
parent
48c9e9d83d
commit
a9e34cba93
3 changed files with 14 additions and 4 deletions
|
@ -232,3 +232,11 @@ void CMonitor::onDisconnect() {
|
||||||
|
|
||||||
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }));
|
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMonitor::addDamage(pixman_region32_t* rg) {
|
||||||
|
wlr_output_damage_add(damage, rg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMonitor::addDamage(wlr_box* box) {
|
||||||
|
wlr_output_damage_add_box(damage, box);
|
||||||
|
}
|
||||||
|
|
|
@ -55,6 +55,8 @@ public:
|
||||||
// methods
|
// methods
|
||||||
void onConnect(bool noRule);
|
void onConnect(bool noRule);
|
||||||
void onDisconnect();
|
void onDisconnect();
|
||||||
|
void addDamage(pixman_region32_t* rg);
|
||||||
|
void addDamage(wlr_box* box);
|
||||||
|
|
||||||
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
|
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
|
||||||
bool m_bEnabled = false;
|
bool m_bEnabled = false;
|
||||||
|
|
|
@ -712,7 +712,7 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
||||||
wlr_region_scale(&damageBoxForEach, &damageBoxForEach, m->scale);
|
wlr_region_scale(&damageBoxForEach, &damageBoxForEach, m->scale);
|
||||||
pixman_region32_translate(&damageBoxForEach, lx + m->vecPosition.x, ly + m->vecPosition.y);
|
pixman_region32_translate(&damageBoxForEach, lx + m->vecPosition.x, ly + m->vecPosition.y);
|
||||||
|
|
||||||
wlr_output_damage_add(m->damage, &damageBoxForEach);
|
m->addDamage(&damageBoxForEach);
|
||||||
}
|
}
|
||||||
|
|
||||||
pixman_region32_fini(&damageBoxForEach);
|
pixman_region32_fini(&damageBoxForEach);
|
||||||
|
@ -733,7 +733,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
wlr_box fixedDamageBox = {damageBox.x - m->vecPosition.x, damageBox.y - m->vecPosition.y, damageBox.width, damageBox.height};
|
wlr_box fixedDamageBox = {damageBox.x - m->vecPosition.x, damageBox.y - m->vecPosition.y, damageBox.width, damageBox.height};
|
||||||
scaleBox(&fixedDamageBox, m->scale);
|
scaleBox(&fixedDamageBox, m->scale);
|
||||||
wlr_output_damage_add_box(m->damage, &fixedDamageBox);
|
m->addDamage(&fixedDamageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
||||||
|
@ -747,7 +747,7 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
||||||
wlr_output_damage_add_box(pMonitor->damage, &damageBox);
|
pMonitor->addDamage(&damageBox);
|
||||||
|
|
||||||
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
||||||
|
|
||||||
|
@ -762,7 +762,7 @@ void CHyprRenderer::damageBox(wlr_box* pBox) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
wlr_box damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
|
wlr_box damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
|
||||||
scaleBox(&damageBox, m->scale);
|
scaleBox(&damageBox, m->scale);
|
||||||
wlr_output_damage_add_box(m->damage, &damageBox);
|
m->addDamage(&damageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
||||||
|
|
Loading…
Reference in a new issue