(width, height int)
| 132 | } |
| 133 | |
| 134 | func computeGenericDeclaredDesktopSize(width, height int) (scaledWidth, scaledHeight int) { |
| 135 | longEdge := max(width, height) |
| 136 | totalPixels := width * height |
| 137 | longEdgeScale := float64(desktopDeclaredMaxLongEdge) / float64(longEdge) |
| 138 | totalPixelsScale := math.Sqrt( |
| 139 | float64(desktopDeclaredMaxTotalPixels) / float64(totalPixels), |
| 140 | ) |
| 141 | scale := min(1.0, longEdgeScale, totalPixelsScale) |
| 142 | |
| 143 | if scale >= 1.0 { |
| 144 | return width, height |
| 145 | } |
| 146 | |
| 147 | return max(1, int(float64(width)*scale)), |
| 148 | max(1, int(float64(height)*scale)) |
| 149 | } |
| 150 | |
| 151 | func scaleDesktopCoordinate(coord, fromDim, toDim int) int { |
| 152 | if toDim <= 0 { |
no outgoing calls
no test coverage detected