(transform, flipMask, width, height)
| 11 | const FLIP_V_BIT_LOCAL = 2; |
| 12 | const FLIP_AD_BIT_LOCAL = 4; |
| 13 | const buildFlipTransform = (transform, flipMask, width, height) => { |
| 14 | const halfW = width / 2; |
| 15 | const halfH = height / 2; |
| 16 | const flippedH = (flipMask & FLIP_H_BIT_LOCAL) !== 0; |
| 17 | const flippedV = (flipMask & FLIP_V_BIT_LOCAL) !== 0; |
| 18 | const flippedAD = (flipMask & FLIP_AD_BIT_LOCAL) !== 0; |
| 19 | |
| 20 | transform.identity(); |
| 21 | transform.translate(halfW, halfH); |
| 22 | if (flippedAD) { |
| 23 | transform.rotate((-90 * Math.PI) / 180); |
| 24 | transform.scale(-1, 1); |
| 25 | } |
| 26 | if (flippedH) { |
| 27 | transform.scale(flippedAD ? 1 : -1, flippedAD ? -1 : 1); |
| 28 | } |
| 29 | if (flippedV) { |
| 30 | transform.scale(flippedAD ? -1 : 1, flippedAD ? 1 : -1); |
| 31 | } |
| 32 | transform.translate(-halfW, -halfH); |
| 33 | return transform; |
| 34 | }; |
| 35 | |
| 36 | /** |
| 37 | * The shader's atlas-sampling code applies the INVERSE of the legacy |
no test coverage detected