From 6b4cc38de62d4cf7f63be2401c4cec41bb99574b Mon Sep 17 00:00:00 2001 From: rakslice Date: Mon, 16 Nov 2020 22:21:46 -0800 Subject: [PATCH] Corresponding header change for BII; cleanup (cherry picked from commit 36ccf8a46a72b6c970df04bd6ecc60efd0363476) --- BasiliskII/src/include/video.h | 8 ++++---- SheepShaver/src/include/video.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BasiliskII/src/include/video.h b/BasiliskII/src/include/video.h index fe4404ef..23bba5e8 100644 --- a/BasiliskII/src/include/video.h +++ b/BasiliskII/src/include/video.h @@ -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 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) { switch (depth) { - case VDEPTH_1BIT: return width / 8; - case VDEPTH_2BIT: return width / 4; - case VDEPTH_4BIT: return width / 2; + case VDEPTH_1BIT: return (width + 7) / 8; + case VDEPTH_2BIT: return (width + 3) / 4; + case VDEPTH_4BIT: return (width + 1) / 2; case VDEPTH_8BIT: return width; case VDEPTH_16BIT: return width * 2; case VDEPTH_32BIT: return width * 4; diff --git a/SheepShaver/src/include/video.h b/SheepShaver/src/include/video.h index 53719dcd..790292ad 100644 --- a/SheepShaver/src/include/video.h +++ b/SheepShaver/src/include/video.h @@ -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) { switch (mode) { - case APPLE_1_BIT: return (width + 7)/8; - case APPLE_2_BIT: return (width + 3)/4; - case APPLE_4_BIT: return (width + 1)/2; + case APPLE_1_BIT: return (width + 7) / 8; + case APPLE_2_BIT: return (width + 3) / 4; + case APPLE_4_BIT: return (width + 1) / 2; case APPLE_8_BIT: return width; case APPLE_16_BIT: return width * 2; case APPLE_32_BIT: return width * 4;