Skip to content

Commit d88bf68

Browse files
smcvslouken
authored andcommitted
surface: Document the in-memory layout of the pixels
I don't think we ever explicitly said this. Signed-off-by: Simon McVittie <[email protected]>
1 parent 3698630 commit d88bf68

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: include/SDL3/SDL_surface.h

+14
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,22 @@ typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */
6666
/**
6767
* \brief A collection of pixels used in software blitting.
6868
*
69+
* Pixels are arranged in memory in rows, with the top row first.
70+
* Each row occupies an amount of memory given by the pitch (sometimes
71+
* known as the row stride in non-SDL APIs).
72+
*
73+
* Within each row, pixels are arranged from left to right until the
74+
* width is reached.
75+
* Each pixel occupies a number of bits appropriate for its format, with
76+
* most formats representing each pixel as one or more whole bytes
77+
* (in some indexed formats, instead multiple pixels are packed into
78+
* each byte), and a byte order given by the format.
79+
* After encoding all pixels, any remaining bytes to reach the pitch are
80+
* used as padding to reach a desired alignment, and have undefined contents.
81+
*
6982
* \note This structure should be treated as read-only, except for \c pixels,
7083
* which, if not NULL, contains the raw pixel data for the surface.
84+
* \sa SDL_CreateSurfaceFrom
7185
*/
7286
typedef struct SDL_Surface
7387
{

0 commit comments

Comments
 (0)