Video showing 1st cut of TFT driver library

Still plodding along with this. Going quite well. Implemented 4 bit grayscale with the rl encoding as it's very compact and easy to uncompress.

The inner part of the drawBitmap routine is large... very large as internally it has code specific to

device color depth + input source color depth + clipping + mode

At the moment color depth 1 or 16, input color depth = 16, 1 or 4, clipping is either 0 or 1 and mode is DIB_BLIT_OR or DIB_BLIT_STORE.

I combine a few variables into a unique 16 bit code from the above and it drops into the correct routine.

if (minx < m_clip_x1 || miny < m_clip_y1 || maxx > m_clip_x2)
  {
    draw_code = 1; // some sort of clipping
  }
  else
  {
    draw_code = 0;
  }
  
  draw_code |= (mode << 1) | (m_bpp << (1 + 3)) | (bmp->m_bpp << (1 + 3 + 6));

The blocks of code themselves have something like...

 case  (0) | (DIB_BLIT_STORE << 1) | (1 << (1 + 3)) | (1 << (1 + 3 + 6)) : // 1 -> 1   STORE

I have about 80% of the combinations done... end result is code that is tightly optimized for each combination. Found very early on that generalized code with too many if's etc in the low level routines resulted in ... well code that worked but with massive performance loss.

The copy of sdfatlib I used... I found out was very old and didn't support the Due. I will have to see if the latest version is any faster. I get about 290 K bytes / sec read speed on it with the Due. The buffer size is also a hard coded 512 which I think may have changed.