(pixel, ratio, width, height, yInvert)
| 59423 | return useDevicePixels ? windowRatio : 1; |
| 59424 | } |
| 59425 | function scalePixels(pixel, ratio, width, height, yInvert) { |
| 59426 | var x = scaleX(pixel[0], ratio, width); |
| 59427 | var y = scaleY(pixel[1], ratio, height, yInvert); |
| 59428 | var t = scaleX(pixel[0] + 1, ratio, width); |
| 59429 | var xHigh = t === width - 1 ? t : t - 1; |
| 59430 | t = scaleY(pixel[1] + 1, ratio, height, yInvert); |
| 59431 | var yHigh; |
| 59432 | if (yInvert) { |
| 59433 | t = t === 0 ? t : t + 1; |
| 59434 | yHigh = y; |
| 59435 | y = t; |
| 59436 | } else yHigh = t === height - 1 ? t : t - 1; |
| 59437 | return { |
| 59438 | x: x, |
| 59439 | y: y, |
| 59440 | width: Math.max(xHigh - x + 1, 1), |
| 59441 | height: Math.max(yHigh - y + 1, 1) |
| 59442 | }; |
| 59443 | } |
| 59444 | function scaleX(x, ratio, width) { |
| 59445 | var r = Math.min(Math.round(x * ratio), width - 1); |
| 59446 | return r; |
no test coverage detected