浏览代码

Resolution: slightly change the calculation

customisations
alemart 11 个月前
父节点
当前提交
47b3adb46f
共有 2 个文件被更改,包括 10 次插入10 次删除
  1. 6
    6
      docs/api/resolution.md
  2. 4
    4
      src/utils/resolution.ts

+ 6
- 6
docs/api/resolution.md 查看文件

@@ -6,15 +6,15 @@ The table below shows examples of how resolution strings are converted to pixels
6 6
 
7 7
 | Resolution | 16:9 landscape | 16:10 landscape | 4:3 landscape | Notes |
8 8
 | ---------- | -------------- | --------------- | ------------- | ----- |
9
-| `"xs"` | 212x120 | 192x120 | 160x120 | |
10
-| `"xs+"` | 284x160 | 256x160 | 212x160 | |
9
+| `"xs"` | 214x120 | 192x120 | 160x120 | |
10
+| `"xs+"` | 284x160 | 256x160 | 214x160 | |
11 11
 | `"sm"` | 356x200 | 320x200 | 266x200 | |
12
-| `"sm+"` | 426x240 | 384x240 | 320x240 | |
12
+| `"sm+"` | 426x240 | 384x240 | 320x240 | 240p |
13 13
 | `"md"` | 568x320 | 512x320 | 426x320 | |
14
-| `"md+"` | 640x360 | 576x360 | 480x360 | |
15
-| `"lg"` | 852x480 | 768x480 | 640x480 | 480p |
14
+| `"md+"` | 640x360 | 576x360 | 480x360 | 360p |
15
+| `"lg"` | 854x480 | 768x480 | 640x480 | 480p |
16 16
 | `"lg+"` | 1066x600 | 960x600 | 800x600 | |
17 17
 | `"xl"` | 1280x720 | 1152x720 | 960x720 | 720p |
18
-| `"xl+"` | 1364x768 | 1228x768 | 1024x768 | |
18
+| `"xl+"` | 1366x768 | 1228x768 | 1024x768 | |
19 19
 | `"xxl"` | 1600x900 | 1440x900 | 1200x900 | |
20 20
 | `"xxl+"` | 1706x960 | 1536x960 | 1280x960 | 960p |

+ 4
- 4
src/utils/resolution.ts 查看文件

@@ -65,14 +65,14 @@ export function computeResolution(resolution: Resolution, aspectRatio: number):
65 65
     if(aspectRatio >= 1) {
66 66
         // landscape
67 67
         height = referenceHeight;
68
-        width = Math.round(height * aspectRatio);
69
-        width -= width % 2;
68
+        width = Math.floor(height * aspectRatio);
69
+        width += width % 2;
70 70
     }
71 71
     else {
72 72
         // portrait
73 73
         width = referenceHeight;
74
-        height = Math.round(width / aspectRatio);
75
-        height -= height % 2;
74
+        height = Math.floor(width / aspectRatio);
75
+        height += height % 2;
76 76
     }
77 77
 
78 78
     return Speedy.Size(width, height);

正在加载...
取消
保存