My initial code (not the above) was actually correct. The frame buffer is in the final format. I was interpreting this code incorrectly on account of me being hasty and it being old.
I just needed an outer loop in my update code.
int line = 0;
for(int y=0;y<height;y+=8) {
for(int x = 0;x<width;x+=8) {
for(int yy=0;yy<8;++yy) {
int yyy = y + yy;
if(x<=bounds.x2&&x+7>=bounds.x1&&yyy<=bounds.y2&&yyy>=bounds.y1) {
const uint8_t* p = m_frame_buffer+(yyy*width+x)/8;
if(!set_line(line,*p)) {
return false;
}
}
++line;
}
}
}
That gets the frame buffer out to the matrices in the right order.