Corresponding header change for BII; cleanup

(cherry picked from commit 36ccf8a46a72b6c970df04bd6ecc60efd0363476)
This commit is contained in:
rakslice 2020-11-16 22:21:46 -08:00
parent c8c1a76381
commit 6b4cc38de6
2 changed files with 8 additions and 8 deletions

View File

@ -79,13 +79,13 @@ inline video_depth DepthModeForPixelDepth(int depth)
// Returns the name of a video_depth, or an empty string if the depth is unknown // Returns the name of a video_depth, or an empty string if the depth is unknown
const char * NameOfDepth(video_depth depth); const char * NameOfDepth(video_depth depth);
// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width // Return a bytes-per-row value (assuming enough bytes to fit the bits but no further padding) for the specified depth and pixel width
inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth) inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth)
{ {
switch (depth) { switch (depth) {
case VDEPTH_1BIT: return width / 8; case VDEPTH_1BIT: return (width + 7) / 8;
case VDEPTH_2BIT: return width / 4; case VDEPTH_2BIT: return (width + 3) / 4;
case VDEPTH_4BIT: return width / 2; case VDEPTH_4BIT: return (width + 1) / 2;
case VDEPTH_8BIT: return width; case VDEPTH_8BIT: return width;
case VDEPTH_16BIT: return width * 2; case VDEPTH_16BIT: return width * 2;
case VDEPTH_32BIT: return width * 4; case VDEPTH_32BIT: return width * 4;

View File

@ -66,13 +66,13 @@ inline int DepthModeForPixelDepth(int depth)
} }
} }
// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width // Return a bytes-per-row value (assuming enough bytes to fit the bits but no further padding) for the specified depth and pixel width
inline uint32 TrivialBytesPerRow(uint32 width, int mode) inline uint32 TrivialBytesPerRow(uint32 width, int mode)
{ {
switch (mode) { switch (mode) {
case APPLE_1_BIT: return (width + 7)/8; case APPLE_1_BIT: return (width + 7) / 8;
case APPLE_2_BIT: return (width + 3)/4; case APPLE_2_BIT: return (width + 3) / 4;
case APPLE_4_BIT: return (width + 1)/2; case APPLE_4_BIT: return (width + 1) / 2;
case APPLE_8_BIT: return width; case APPLE_8_BIT: return width;
case APPLE_16_BIT: return width * 2; case APPLE_16_BIT: return width * 2;
case APPLE_32_BIT: return width * 4; case APPLE_32_BIT: return width * 4;