#9064 closed bug (fixed)
An invalidated BView does not draw to a BBitmap
Reported by: | axeld | Owned by: | nobody |
---|---|---|---|
Priority: | high | Milestone: | R1/beta5 |
Component: | Servers/app_server | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
When you have the following construct, nothing will ever be drawn to the bitmap:
BBitmap* bitmap = new BBitmap(frame, B_RGBA32, true); BView* view = new BView(bitmap->Bounds(), NULL, 0, B_WILL_DRAW); bitmap->AddChild(view); if (view->LockLooper()) { view->Invalidate(); view->SetHighColor(225, 225, 225, 128); view->FillRect(view->Bounds()); view->UnlockLooper(); }
If you remove the Invalidate(), the drawing operation is performed as expected. Needless to say, the code above worked fine under BeOS.
Attachments (1)
Change History (5)
comment:1 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 2 years ago
Attachment: | DrawBitmapTestModified.cpp added |
---|
comment:2 by , 2 years ago
I think the problem relates to the fact that BBitmap::fWindow cannot receive messages because it is an offscreen BWindow, which means Run is never called.
BView::Invalidate sends an AS_VIEW_INVALIDATE_RECT message to the OffscreenWindow that corresponds to fWindow. The OffscreenWindow, in response, sends back an _UPDATE_ message. Since fWindow can't receive messages, it does not make the expected reply (AS_BEGIN_UPDATE) to the OffscreenWindow. This leaves the OffscreenWindow in a state where fUpdateRequested is true and fInUpdate is false. In this state, Window::GetEffectiveDrawingRegion will decide that the invalidated area can't be drawn to.
This situation can be avoided if OffscreenWindow's base member Window::fUpdatesEnabled is false, because then Window::_SendUpdateMessage won't send the _UPDATE_ message and won't set fUpdateRequested to true. Suggested patch: https://review.haiku-os.org/c/haiku/+/5967.
follow-up: 4 comment:3 by , 2 years ago
Milestone: | R1 → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in hrev56677.
Reproduces bug