mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
+ added somewhat proper scaling of (small) backgrounds
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
48da16f7e5
commit
0a95b27272
@ -203,6 +203,22 @@ void CWallpaper::render (glm::vec4 viewport, bool newFrame)
|
||||
float widthRatio = windowWidth / viewport.z;
|
||||
float heightRatio = windowHeight / viewport.w;
|
||||
|
||||
if (widthRatio < 1.0f)
|
||||
{
|
||||
float diff = 1.0f - widthRatio;
|
||||
|
||||
widthRatio += diff;
|
||||
heightRatio += diff;
|
||||
}
|
||||
|
||||
if (heightRatio < 1.0f)
|
||||
{
|
||||
float diff = 1.0f - widthRatio;
|
||||
|
||||
widthRatio += diff;
|
||||
heightRatio += diff;
|
||||
}
|
||||
|
||||
GLfloat position [] = {
|
||||
widthRatio * -1.0f, heightRatio * 1.0f, 0.0f,
|
||||
widthRatio * 1.0f, heightRatio * 1.0f, 0.0f,
|
||||
|
Loading…
Reference in New Issue
Block a user