Fast scrolling - By tikkel

Author :  tikkel

Hello, I would like to scroll the screen. Either one line up/down or one column left/right.
Sure, I could just refresh (as before) the entire screen. But that's too heavy CPU for me (up to 150 drawImage() calls per frame at 40fps). I'm now ended  at a CPU load of 110%.
If I am correct, the gb.update() transfers a buffer into the TFT memory via DMA. Does anyone know if this is a single or double buffer? If it is a double buffer, could I then use the normal gb.display.drawImage() with cropping information to move the screen?

Has anyone any idea or even something already programmed?

Author :  Alban


I have not tried and program scrolling for the Gamebuino Meta, but I can give you pointers on how the internals work :

  • Between calls to gb.update(), drawing is done on gb.display._buffer.
  • When gb.update() is called, slices of gb.display._buffer are read, possibly translated in tft format, and sent to the tft.

So this can look like double buffering.

I suppose you can perform scrolling by moving areas of gb.display._buffer on itself. Update: nah, I suppose it gets cleared when leaving gb.update() (no time to check, sorry)

Author :  tikkel


gb.display.drawImage(0, 0+1, _buffer, 0, 0, 80, 63);

what must i set for _buffer?

Author :  tikkel

Hi Alban, thanks for your push ... scrolls 1 pixelline up  :o)

//dst, src, width/2(idx)|width*2(rgb)
memcpy(gb.display._buffer+80*0, gb.display._buffer+80*1, 80*2*63);

(The API-sourcecode of Image.cpp (at line 438+) was also helpful.)