0

In VGA mode of the PC and in some older game consoles, it is possible to scroll the display by a pixel by incrementing a register. This only uses a single CPU instruction.

In modern devices, including laptops and mobiles with GPUs, do they still use this method or do they do something like the following pseudocode, when we scroll an app or a webpage:

for x in 0..framebuffer_width {
  for y in 0..framebuffer_height {
    framebuffer[x][y] = framebuffer[x][y+1];
  }
}

thus requiring far more CPU instructions?

itsfarseen
  • 1,109
  • 10
  • 25

1 Answers1

1

"Scrolling" is largely not a thing in graphics hardware and hasn't been for decades.

Some programs perform scrolling by saving a rendered image internally and blitting part of it, generating the off-screen portion with drawing commands. But most programs (particularly games) just redraw the entire screen every frame.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • "blitting part of it." What do you mean by part of it? Could you elaborate? Could you explain how a web browser or a GUI toolkit like GTK or Qt would do it? – itsfarseen Oct 08 '22 at 20:29