From f6cef39e1ec4c0ff4bfb97a78444a946eb0eab03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 20 Dec 2005 22:22:26 +0000 Subject: [PATCH] row_bytes was used in a weird way, and still is, if you would take row_bytes literally git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15622 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/game/direct_window_test/StarWindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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