diff --git a/src/tests/kits/game/direct_window_test/StarWindow.cpp b/src/tests/kits/game/direct_window_test/StarWindow.cpp index 31323af5e3..31c77af8c7 100644 --- a/src/tests/kits/game/direct_window_test/StarWindow.cpp +++ b/src/tests/kits/game/direct_window_test/StarWindow.cpp @@ -352,12 +352,13 @@ StarWindow::SwitchContext(direct_buffer_info *info) } // update the new rowbyte - row_bytes = info->bytes_per_row/(info->bits_per_pixel/8); + // NOTE: "row_bytes" is completely misnamed, and was misused too + row_bytes = info->bytes_per_row / (info->bits_per_pixel / 8); // update the screen bases (only one of the 3 will be really used). - draw_ptr8 = ((uint8*)info->bits) + row_bytes*info->window_bounds.top + info->window_bounds.left; - draw_ptr16 = ((uint16*)info->bits) + row_bytes*info->window_bounds.top + info->window_bounds.left; - draw_ptr32 = ((uint32*)info->bits) + row_bytes*info->window_bounds.top + info->window_bounds.left; + draw_ptr8 = (uint8*)info->bits + info->bytes_per_row * info->window_bounds.top + (info->window_bounds.left * info->bits_per_pixel / 8); + draw_ptr16 = (uint16*)draw_ptr8; + draw_ptr32 = (uint32*)draw_ptr8; // cancel the erasing of all stars if the buffer has been reset. // Because of a bug in the R3 direct window protocol, B_BUFFER_RESET is not set