Bläddra i källkod

+ added somewhat proper scaling of (small) backgrounds

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 5 år sedan
förälder
incheckning
0a95b27272
1 ändrade filer med 16 tillägg och 0 borttagningar
  1. 16 0
      src/WallpaperEngine/Render/CWallpaper.cpp

+ 16 - 0
src/WallpaperEngine/Render/CWallpaper.cpp

@@ -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,