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
This commit is contained in:
Marcus Overhagen 2006-04-06 20:25:58 +00:00
parent 8fe515059d
commit 6dcf803e48

View File

@ -1118,24 +1118,26 @@ DrawingEngine::ReadBitmap(ServerBitmap *bitmap, bool drawCursor, BRect bounds)
bounds = bounds & clip; bounds = bounds & clip;
fGraphicsCard->HideSoftwareCursor(bounds); fGraphicsCard->HideSoftwareCursor(bounds);
status_t result = bitmap->ImportBits(buffer->Bits(), status_t result = bitmap->ImportBits(buffer->Bits(), buffer->BitsLength(),
buffer->BitsLength(), buffer->BytesPerRow(), buffer->ColorSpace(), buffer->BytesPerRow(), buffer->ColorSpace(),
bounds.LeftTop(), BPoint(0, 0), bounds.IntegerWidth() + 1, bounds.LeftTop(), BPoint(0, 0),
bounds.IntegerHeight() + 1); bounds.IntegerWidth() + 1, bounds.IntegerHeight() + 1);
if (drawCursor) { if (drawCursor) {
ServerCursor *cursor = fGraphicsCard->Cursor(); ServerCursor *cursor = fGraphicsCard->Cursor();
int32 cursorWidth = cursor->Bounds().IntegerWidth(); int32 cursorWidth = cursor->Width();
int32 cursorHeight = cursor->Bounds().IntegerHeight(); int32 cursorHeight = cursor->Height();
BPoint cursorPosition = fGraphicsCard->GetCursorPosition(); BPoint cursorPosition = fGraphicsCard->GetCursorPosition();
cursorPosition -= bounds.LeftTop() + cursor->GetHotSpot(); 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); B_BITMAP_NO_SERVER_LINK, B_RGBA32);
cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(),
bitmap->BytesPerRow(), bitmap->ColorSpace(), cursorPosition, cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(),
BPoint(0, 0), cursorWidth, cursorHeight); bitmap->BytesPerRow(), bitmap->ColorSpace(),
cursorPosition, BPoint(0, 0),
cursorWidth, cursorHeight);
uint8 *bits = (uint8 *)cursorArea.Bits(); uint8 *bits = (uint8 *)cursorArea.Bits();
uint8 *cursorBits = (uint8 *)cursor->Bits(); uint8 *cursorBits = (uint8 *)cursor->Bits();
@ -1152,7 +1154,8 @@ DrawingEngine::ReadBitmap(ServerBitmap *bitmap, bool drawCursor, BRect bounds)
bitmap->ImportBits(cursorArea.Bits(), cursorArea.BitsLength(), bitmap->ImportBits(cursorArea.Bits(), cursorArea.BitsLength(),
cursorArea.BytesPerRow(), cursorArea.ColorSpace(), cursorArea.BytesPerRow(), cursorArea.ColorSpace(),
BPoint(0, 0), cursorPosition, cursorWidth, cursorHeight); BPoint(0, 0), cursorPosition,
cursorWidth, cursorHeight);
} }
fGraphicsCard->ShowSoftwareCursor(); fGraphicsCard->ShowSoftwareCursor();