Adjust all in-tree applications after BBitmap::ImportBits API changes.

Change-Id: If3a06f35c01089cdbb696de479984f2b59fce7a0
This commit is contained in:
Augustin Cavalier
2022-01-07 22:05:18 -05:00
parent edd3417172
commit 644c29d069
6 changed files with 14 additions and 36 deletions
+1 -2
View File
@@ -1293,8 +1293,7 @@ RemoteView::_DrawThread()
// TODO: support the drawCursor flag
BBitmap bitmap(bounds, B_BITMAP_NO_SERVER_LINK, B_RGB32);
bitmap.ImportBits(fOffscreenBitmap, bounds.LeftTop(),
BPoint(0, 0), bounds.IntegerWidth() + 1,
bounds.IntegerHeight() + 1);
BPoint(0, 0), bounds.Size());
reply.Start(RP_READ_BITMAP_RESULT);
reply.Add(token);
+4 -8
View File
@@ -224,20 +224,16 @@ Screenshot::_New(bigtime_t delay)
// Put the mouse area in a bitmap
BRect bounds = fUtility->cursorBitmap->Bounds();
int cursorWidth = bounds.IntegerWidth() + 1;
int cursorHeight = bounds.IntegerHeight() + 1;
fUtility->cursorAreaBitmap = new BBitmap(bounds, B_RGBA32);
fUtility->cursorAreaBitmap->ImportBits(fUtility->wholeScreen->Bits(),
fUtility->wholeScreen->BitsLength(),
fUtility->wholeScreen->BytesPerRow(),
fUtility->wholeScreen->ColorSpace(),
fUtility->cursorPosition, BPoint(0, 0),
cursorWidth, cursorHeight);
fUtility->cursorAreaBitmap->ImportBits(fUtility->wholeScreen,
fUtility->cursorPosition, BPoint(0, 0), bounds.Size());
// Fill in the background of the mouse bitmap
uint8* bits = (uint8*)fUtility->cursorBitmap->Bits();
uint8* areaBits = (uint8*)fUtility->cursorAreaBitmap->Bits();
int cursorWidth = bounds.IntegerWidth() + 1;
int cursorHeight = bounds.IntegerHeight() + 1;
for (int32 i = 0; i < cursorHeight; i++) {
for (int32 j = 0; j < cursorWidth; j++) {
uint8 alpha = 255 - bits[3];
+6 -23
View File
@@ -139,28 +139,14 @@ Utility::MakeScreenshot(bool includeMouse, bool activeWindow,
if (wholeScreen == NULL)
return NULL;
int cursorWidth = 0;
int cursorHeight = 0;
if (cursorBitmap != NULL) {
BRect bounds = cursorBitmap->Bounds();
cursorWidth = bounds.IntegerWidth() + 1;
cursorHeight = bounds.IntegerHeight() + 1;
}
if (includeMouse && cursorBitmap != NULL) {
// Import the cursor bitmap into wholeScreen
wholeScreen->ImportBits(cursorBitmap->Bits(),
cursorBitmap->BitsLength(), cursorBitmap->BytesPerRow(),
cursorBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
cursorWidth, cursorHeight);
wholeScreen->ImportBits(cursorBitmap,
B_ORIGIN, cursorPosition, cursorBitmap->Bounds().Size());
} else if (cursorAreaBitmap != NULL) {
// Import the cursor area bitmap into wholeScreen
wholeScreen->ImportBits(cursorAreaBitmap->Bits(),
cursorAreaBitmap->BitsLength(), cursorAreaBitmap->BytesPerRow(),
cursorAreaBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
cursorWidth, cursorHeight);
wholeScreen->ImportBits(cursorAreaBitmap,
B_ORIGIN, cursorPosition, cursorAreaBitmap->Bounds().Size());
}
BBitmap* screenshot = NULL;
@@ -175,11 +161,8 @@ Utility::MakeScreenshot(bool includeMouse, bool activeWindow,
screenshot = new BBitmap(frame.OffsetToCopy(B_ORIGIN),
includeBorder ? B_RGBA32 : B_RGB32, true);
if (screenshot->ImportBits(wholeScreen->Bits(),
wholeScreen->BitsLength(), wholeScreen->BytesPerRow(),
wholeScreen->ColorSpace(), frame.LeftTop(),
BPoint(0, 0), frame.IntegerWidth() + 1,
frame.IntegerHeight() + 1) != B_OK) {
if (screenshot->ImportBits(wholeScreen, frame.LeftTop(),
B_ORIGIN, frame.Size()) != B_OK) {
delete screenshot;
return NULL;
}
+1 -1
View File
@@ -192,7 +192,7 @@ BImageResources::GetIconResource(int32 id, icon_size size,
float x = roundf((dest->Bounds().Width() - size) / 2);
float y = roundf((dest->Bounds().Height() - size) / 2);
return dest->ImportBits(data, (int32)length, size, B_CMAP8,
BPoint(0, 0), BPoint(x, y), size, size);
BPoint(0, 0), BPoint(x, y), BSize(size - 1, size - 1));
}
+1 -1
View File
@@ -1505,7 +1505,7 @@ DrawingEngine::ReadBitmap(ServerBitmap* bitmap, bool drawCursor, BRect bounds)
cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(),
bitmap->BytesPerRow(), bitmap->ColorSpace(),
cursorPosition, BPoint(0, 0),
cursorWidth, cursorHeight);
cursorArea.Bounds().Size());
uint8* bits = (uint8*)cursorArea.Bits();
uint8* cursorBits = (uint8*)cursor->Bits();
+1 -1
View File
@@ -734,7 +734,7 @@ private:
fCurrentIconBitmap->ImportBits(sourceBitmap,
BPoint(0, fCurrentAnimationRow),
BPoint(0, fCurrentAnimationRow),
sourceBitmap->Bounds().IntegerWidth(), 1);
BSize(sourceBitmap->Bounds().IntegerWidth() - 1, 0));
fCurrentAnimationRow--;