| 54 | |
| 55 | // |
| 56 | inline void upscale(const CRGB *input, CRGB *output, u16 inputWidth, |
| 57 | u16 inputHeight, const fl::XYMap& xyMap) { |
| 58 | u16 outputWidth = xyMap.getWidth(); |
| 59 | u16 outputHeight = xyMap.getHeight(); |
| 60 | const bool wontFit = |
| 61 | (outputWidth != xyMap.getWidth() || outputHeight != xyMap.getHeight()); |
| 62 | |
| 63 | // Check if we can use the optimized rectangular version |
| 64 | const bool isRectangular = (xyMap.getType() == XYMap::kLineByLine); |
| 65 | |
| 66 | if (isRectangular) { |
| 67 | // Use optimized rectangular version that bypasses XY mapping |
| 68 | if (wontFit || (inputWidth & (inputWidth - 1)) || |
| 69 | (inputHeight & (inputHeight - 1))) { |
| 70 | upscaleRectangular(input, output, inputWidth, inputHeight, |
| 71 | outputWidth, outputHeight); |
| 72 | } else { |
| 73 | upscaleRectangularPowerOf2(input, output, inputWidth, inputHeight, |
| 74 | outputWidth, outputHeight); |
| 75 | } |
| 76 | } else { |
| 77 | // Use the original XY-mapped versions |
| 78 | if (wontFit || (inputWidth & (inputWidth - 1)) || |
| 79 | (inputHeight & (inputHeight - 1))) { |
| 80 | upscaleArbitrary(input, output, inputWidth, inputHeight, xyMap); |
| 81 | } else { |
| 82 | upscalePowerOf2(input, output, inputWidth, inputHeight, xyMap); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // These are here for testing purposes and are slow. Their primary use |
| 88 | // is to test against the fixed integer version above. |
no test coverage detected