http://mcosre.sourceforge.net/fixes/rowBytes_fix.html
7/20/2007

M c O S   R e

"rowBytes" fix
 
[Home] | [About McOS Re] | [FAQ] | [Changes] | [Progress] | [Documentation] | [Links]


"I tried to boot 0.4.2f on 7600 (built-in video, Apple 21",
1152x870), McOS Re shows lines instead of happy macs."

-- Wolfgang Oblasser


 
  Wolfgang Oblasser is author
  of the McOS Re logo.
 

For a screen resolution of 640 by 480, each screen line requires at least 640 pixels. The color of the first pixel on the screen (top left corner) is defined by the first byte of VRAM. The second byte (256 color mode) defines the color of the second pixel and so on right up to pixel 639 (pixels are numbered from 0). You would expect the first pixel of the second line to be defined by byte 640, as each line is 640 pixels wide -- this may or may not be the case depending on the screen.

(from Technical Note #117 "Compatibility: Why & How")

 
  • To get the number of bytes on a line check the QuickDraw global screenBits.rowBytes.
  • To get the screen width check the QuickDraw global screenBits.bounds.right.
  • To do screen-size calculations use 32-bit integers.

Don't assume that rowBytes is equal to the width of the screen.