* A replacement for context.drawImage * (args are for source and destination).
(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh)
| 34 | * (args are for source and destination). |
| 35 | */ |
| 36 | function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) { |
| 37 | var vertSquashRatio = detectVerticalSquash(img); |
| 38 | // Works only if whole image is displayed: |
| 39 | // ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio); |
| 40 | // The following works correct also when only a part of the image is displayed: |
| 41 | ctx.drawImage(img, sx * vertSquashRatio, sy * vertSquashRatio, |
| 42 | sw * vertSquashRatio, sh * vertSquashRatio, |
| 43 | dx, dy, dw, dh ); |
| 44 | } |
| 45 | |
| 46 | function drawImageIOS(ctx, img, dw, dh){ |
| 47 | var sx = 0, |
no test coverage detected