mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-09-11 19:07:40 +03:00
fix scaling image
This commit is contained in:
parent
5f494286b2
commit
2c7927aa5a
@ -342,14 +342,14 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
|
||||
float scale;
|
||||
Vector2D origin;
|
||||
if (pMonitor->size.x / pMonitor->size.y > PWALLPAPERTARGET->m_vSize.x / PWALLPAPERTARGET->m_vSize.y) {
|
||||
scale = pMonitor->size.x / PWALLPAPERTARGET->m_vSize.x;
|
||||
scale = pMonitor->size.x * pMonitor->scale / PWALLPAPERTARGET->m_vSize.x;
|
||||
|
||||
origin.y = - (PWALLPAPERTARGET->m_vSize.y * scale - pMonitor->size.y) / 2.f / scale;
|
||||
origin.y = - (PWALLPAPERTARGET->m_vSize.y * scale - pMonitor->size.y * pMonitor->scale) / 2.f / scale;
|
||||
|
||||
} else {
|
||||
scale = pMonitor->size.y / PWALLPAPERTARGET->m_vSize.y;
|
||||
scale = pMonitor->size.y * pMonitor->scale / PWALLPAPERTARGET->m_vSize.y;
|
||||
|
||||
origin.x = - (PWALLPAPERTARGET->m_vSize.x * scale - pMonitor->size.x) / 2.f / scale;
|
||||
origin.x = - (PWALLPAPERTARGET->m_vSize.x * scale - pMonitor->size.x * pMonitor->scale) / 2.f / scale;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Image data for %s: %s at [%.2f, %.2f], scale: %.2f (original image size: [%i, %i])", pMonitor->name.c_str(), PWALLPAPERTARGET->m_szPath.c_str(), origin.x, origin.y, scale, (int)PWALLPAPERTARGET->m_vSize.x, (int)PWALLPAPERTARGET->m_vSize.y);
|
||||
|
Loading…
Reference in New Issue
Block a user