non 32 bit offscreen bitmaps were never cleared to white, due to the way they currently work: when the offscreen window is created, the current content of the bitmap is copied to the back buffer, and since the clearing came later, it was never copied to it. This fixes the problem with FlattenPictureTest not working correctly for colorspace different than RGB(A)32.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-09-09 13:28:30 +00:00
parent 8b330bfe28
commit f8a63d3a0b

View File

@ -1055,16 +1055,6 @@ BBitmap::_InitObject(BRect bounds, color_space colorSpace, uint32 flags,
fInitError = error;
if (fInitError == B_OK) {
if (flags & B_BITMAP_ACCEPTS_VIEWS) {
fWindow = new(std::nothrow) BWindow(Bounds(), fServerToken);
if (fWindow) {
// A BWindow starts life locked and is unlocked
// in Show(), but this window is never shown and
// it's message loop is never started.
fWindow->Unlock();
} else
fInitError = B_NO_MEMORY;
}
// clear to white if the flags say so.
if (flags & (B_BITMAP_CLEAR_TO_WHITE | B_BITMAP_ACCEPTS_VIEWS)) {
if (fColorSpace == B_CMAP8) {
@ -1076,6 +1066,20 @@ BBitmap::_InitObject(BRect bounds, color_space colorSpace, uint32 flags,
memset(fBasePointer, 0xff, fSize);
}
}
// TODO: Creating an offscreen window with a non32 bit bitmap
// copies the current content of the bitmap to a back buffer.
// So at this point the bitmap has to be already cleared to white.
// Better move the above code to the server so the problem looks more clear.
if (flags & B_BITMAP_ACCEPTS_VIEWS) {
fWindow = new(std::nothrow) BWindow(Bounds(), fServerToken);
if (fWindow) {
// A BWindow starts life locked and is unlocked
// in Show(), but this window is never shown and
// it's message loop is never started.
fWindow->Unlock();
} else
fInitError = B_NO_MEMORY;
}
}
}