소스 검색

+ added somewhat proper scaling of (small) backgrounds

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 5 년 전
부모
커밋
0a95b27272
1개의 변경된 파일과 16개의 추가작업 그리고 0개의 파일을 삭제
  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,