basic provision for feeding external pictures to the cameras

This commit is contained in:
Arisotura
2022-04-17 14:53:57 +02:00
committed by Nadia Holmquist Pedersen
parent 59a5923463
commit ee61062aa1
5 changed files with 49 additions and 1 deletions

View File

@ -758,6 +758,30 @@ void Camera::MCU_Write(u16 addr, u8 val)
MCURegs[addr] = val;
}
void Camera::InputFrame(u32* data, int width, int height)
{
// TODO: double-buffering?
if (width == 640 && height == 480)
{
memcpy(FrameBuffer, data, 640*480*sizeof(u32));
return;
}
for (int dy = 0; dy < 480; dy++)
{
int sy = (dy * height) / 480;
for (int dx = 0; dx < 640; dx++)
{
int sx = (dx * width) / 640;
FrameBuffer[dy*640 + dx] = data[sy*width + sx];
}
}
}
}