mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-11-16 22:25:59 +01:00
internal: fix crash on scale change
This commit is contained in:
parent
e95b8d59f3
commit
9a8a5738c6
1 changed files with 6 additions and 2 deletions
|
@ -392,10 +392,14 @@ void CHyprpaper::destroyBuffer(SPoolBuffer* pBuffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWallpaperTarget) {
|
SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWallpaperTarget) {
|
||||||
return std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) {
|
const auto IT = std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) {
|
||||||
auto scale = std::round((pMonitor->pCurrentLayerSurface && pMonitor->pCurrentLayerSurface->pFractionalScaleInfo ? pMonitor->pCurrentLayerSurface->fScale : pMonitor->scale) * 120.0) / 120.0;
|
auto scale = std::round((pMonitor->pCurrentLayerSurface && pMonitor->pCurrentLayerSurface->pFractionalScaleInfo ? pMonitor->pCurrentLayerSurface->fScale : pMonitor->scale) * 120.0) / 120.0;
|
||||||
return el->target == pWallpaperTarget->m_szPath && vectorDeltaLessThan(el->pixelSize, pMonitor->size * scale, 1);
|
return el->target == pWallpaperTarget->m_szPath && vectorDeltaLessThan(el->pixelSize, pMonitor->size * scale, 1);
|
||||||
})->get();
|
});
|
||||||
|
|
||||||
|
if (IT == m_vBuffers.end())
|
||||||
|
return nullptr;
|
||||||
|
return IT->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
|
void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
|
||||||
|
|
Loading…
Reference in a new issue