(nativeWidth, nativeHeight int)
| 106 | } |
| 107 | |
| 108 | func computeDeclaredDesktopSize(nativeWidth, nativeHeight int) (declaredWidth, declaredHeight int) { |
| 109 | if desktopSizeFitsDeclaredLimits(nativeWidth, nativeHeight) { |
| 110 | return nativeWidth, nativeHeight |
| 111 | } |
| 112 | |
| 113 | if nativeWidth >= nativeHeight { |
| 114 | for _, declaredWidth := range preferredDeclaredDesktopWidths { |
| 115 | if declaredWidth > nativeWidth { |
| 116 | continue |
| 117 | } |
| 118 | |
| 119 | declaredHeight := max(1, declaredWidth*nativeHeight/nativeWidth) |
| 120 | if desktopSizeFitsDeclaredLimits(declaredWidth, declaredHeight) { |
| 121 | return declaredWidth, declaredHeight |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | return computeGenericDeclaredDesktopSize(nativeWidth, nativeHeight) |
| 127 | } |
| 128 | |
| 129 | func desktopSizeFitsDeclaredLimits(width, height int) bool { |
| 130 | return max(width, height) <= desktopDeclaredMaxLongEdge && |
no test coverage detected