Fix an offset calculation error.

This commit is contained in:
Relintai 2020-12-23 17:30:52 +01:00
parent fb5d8fabf1
commit bd99035701
2 changed files with 9 additions and 2 deletions

View File

@ -12,3 +12,8 @@ link_directories(/opt/vc/lib)
add_executable(fbcp main.c)
target_link_libraries(fbcp bcm_host)
set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")

6
main.c
View File

@ -154,10 +154,12 @@ int process_interlaced() {
uint16_t *src = &screenbuf[bufNum][firstRow * vinfo.xres + firstCol];
uint16_t *dst = (uint16_t *)&fbp[(firstRow * vinfo.xres + firstCol) * 2];
uint32_t moffset = vinfo.xres * INTERLACE_NUM;
for(int row = firstRow; row <= lastRow; row += INTERLACE_NUM) {
memcpy(dst, src, bytes);
src += vinfo.xres;
dst += vinfo.xres;
src += moffset;
dst += moffset;
}
// memcpy(fbp, screenbuf[2], vinfo.xres * vinfo.yres * 2);