From 6dcf803e4857bb503adb56dc119cc4b0be987df4 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Thu, 6 Apr 2006 20:25:58 +0000 Subject: [PATCH] removed some off-by-one errors. replaced cursor->Bounds().IntegerWidth() with cursor->Width() which is equal to cursor->Bounds().IntegerWidth() + 1 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17032 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/DrawingEngine.cpp | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/servers/app/drawing/DrawingEngine.cpp b/src/servers/app/drawing/DrawingEngine.cpp index 837429c097..272b4b9cc5 100644 --- a/src/servers/app/drawing/DrawingEngine.cpp +++ b/src/servers/app/drawing/DrawingEngine.cpp @@ -1118,24 +1118,26 @@ DrawingEngine::ReadBitmap(ServerBitmap *bitmap, bool drawCursor, BRect bounds) bounds = bounds & clip; fGraphicsCard->HideSoftwareCursor(bounds); - status_t result = bitmap->ImportBits(buffer->Bits(), - buffer->BitsLength(), buffer->BytesPerRow(), buffer->ColorSpace(), - bounds.LeftTop(), BPoint(0, 0), bounds.IntegerWidth() + 1, - bounds.IntegerHeight() + 1); + status_t result = bitmap->ImportBits(buffer->Bits(), buffer->BitsLength(), + buffer->BytesPerRow(), buffer->ColorSpace(), + bounds.LeftTop(), BPoint(0, 0), + bounds.IntegerWidth() + 1, bounds.IntegerHeight() + 1); if (drawCursor) { ServerCursor *cursor = fGraphicsCard->Cursor(); - int32 cursorWidth = cursor->Bounds().IntegerWidth(); - int32 cursorHeight = cursor->Bounds().IntegerHeight(); + int32 cursorWidth = cursor->Width(); + int32 cursorHeight = cursor->Height(); BPoint cursorPosition = fGraphicsCard->GetCursorPosition(); cursorPosition -= bounds.LeftTop() + cursor->GetHotSpot(); - BBitmap cursorArea(BRect(0, 0, cursorWidth, cursorHeight), + BBitmap cursorArea(BRect(0, 0, cursorWidth - 1, cursorHeight - 1), B_BITMAP_NO_SERVER_LINK, B_RGBA32); - cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(), - bitmap->BytesPerRow(), bitmap->ColorSpace(), cursorPosition, - BPoint(0, 0), cursorWidth, cursorHeight); + + cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(), + bitmap->BytesPerRow(), bitmap->ColorSpace(), + cursorPosition, BPoint(0, 0), + cursorWidth, cursorHeight); uint8 *bits = (uint8 *)cursorArea.Bits(); uint8 *cursorBits = (uint8 *)cursor->Bits(); @@ -1152,7 +1154,8 @@ DrawingEngine::ReadBitmap(ServerBitmap *bitmap, bool drawCursor, BRect bounds) bitmap->ImportBits(cursorArea.Bits(), cursorArea.BitsLength(), cursorArea.BytesPerRow(), cursorArea.ColorSpace(), - BPoint(0, 0), cursorPosition, cursorWidth, cursorHeight); + BPoint(0, 0), cursorPosition, + cursorWidth, cursorHeight); } fGraphicsCard->ShowSoftwareCursor();