* removed declarations for methods which are not used/implemented in View.h

* improved naming of some private BView functions and used our underscore
  prefix
* added a _DrawAfterChildren method to BView which does the necessary setup
  and calls the DrawAfterChildren hook
* call the new _DrawAfterChildren method in the BWindow implementation, this
  was easy since the view tokens are already hierachically sorted
* implement support for B_DRAW_ON_CHILDREN in the app_server's ViewLayer, it
  simply means that children are ignored for the views clipping region, any
  drawing methods will paint over children (therefor the B_DRAW_ON_CHILDREN
  flag is even properly named)

With these changes, support for B_DRAW_ON_CHILDREN and the DrawAfterChildren()
hook are implemented and behave exactly as on R5 as far as I can tell, also
for the view background painting.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23154 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2007-12-25 14:47:06 +00:00
parent 11dbc914f7
commit 099fb2d3be
5 changed files with 234 additions and 220 deletions
+20 -24
View File
@@ -565,35 +565,30 @@ private:
BView(const BView&); BView(const BView&);
BView& operator=(const BView&); BView& operator=(const BView&);
void _InitData(BRect frame, const char* name, uint32 resizeMask, void _InitData(BRect frame, const char* name,
uint32 flags); uint32 resizeMask, uint32 flags);
status_t _SetViewBitmap(const BBitmap* bitmap,BRect srcRect, status_t _SetViewBitmap(const BBitmap* bitmap,
BRect dstRect, uint32 followFlags, uint32 options); BRect srcRect, BRect dstRect,
void DoBezier(int32 gr, BPoint* controlPoints, pattern p); uint32 followFlags, uint32 options);
void DoShape(int32 gr, BShape* shape, pattern p); void _ClipToPicture(BPicture* picture, BPoint where,
void DoPictureClip(BPicture* picture, BPoint where, bool invert, bool invert, bool sync);
bool sync);
bool do_owner_check() const; bool _CheckOwnerLockAndSwitchCurrent() const;
bool do_owner_check_no_pick() const; bool _CheckOwnerLock() const;
void check_lock() const; void _CheckLockAndSwitchCurrent() const;
void check_lock_no_pick() const; void _CheckLock() const;
void _SwitchServerCurrentView() const;
void _SetOwner(BWindow* newOwner); void _SetOwner(BWindow* newOwner);
void handle_tick(); void _RemoveCommArray();
char* test_area(int32 length);
void removeCommArray();
void SetScroller(BScrollBar* sb);
void UnsetScroller(BScrollBar* sb);
void RealScrollTo(BPoint);
void fetch_font();
uchar font_encoding() const;
BShelf* _Shelf() const; BShelf* _Shelf() const;
void _SetShelf(BShelf* shelf); void _SetShelf(BShelf* shelf);
void _MoveTo(int32 x, int32 y); void _MoveTo(int32 x, int32 y);
void _ResizeBy(int32 deltaWidth, int32 deltaHeight); void _ResizeBy(int32 deltaWidth, int32 deltaHeight);
void _ParentResizedBy(int32 x, int32 y); void _ParentResizedBy(int32 deltaWidth,
int32 deltaHeight);
void _ConvertToScreen(BPoint* pt, bool checkLock) const; void _ConvertToScreen(BPoint* pt, bool checkLock) const;
void _ConvertFromScreen(BPoint* pt, bool checkLock) const; void _ConvertFromScreen(BPoint* pt, bool checkLock) const;
@@ -605,7 +600,8 @@ private:
void _Activate(bool state); void _Activate(bool state);
void _Attach(); void _Attach();
void _Detach(); void _Detach();
void _Draw(BRect updateRect); void _Draw(BRect screenUpdateRect);
void _DrawAfterChildren(BRect screenUpdateRect);
void _Pulse(); void _Pulse();
void _UpdateStateForRemove(); void _UpdateStateForRemove();
@@ -621,8 +617,8 @@ private:
bool _RemoveSelf(); bool _RemoveSelf();
// Debugging methods // Debugging methods
void PrintToStream(); void _PrintToStream();
void PrintTree(); void _PrintTree();
int32 server_token; int32 server_token;
uint32 fFlags; uint32 fFlags;
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -1195,11 +1195,14 @@ FrameMoved(origin);
printf("_UPDATE_ - didn't find view by token: %ld\n", (int32)tokens.ItemAtFast(i)); printf("_UPDATE_ - didn't find view by token: %ld\n", (int32)tokens.ItemAtFast(i));
//drawTime += system_time() - drawStart; //drawTime += system_time() - drawStart;
} }
// TODO: the tokens are actually hirachically sorted, // NOTE: The tokens are actually hirachically sorted,
// so traversing the list in revers and calling // so traversing the list in revers and calling
// child->DrawAfterChildren would actually work correctly, // child->DrawAfterChildren actually works correctly
// only that drawing outside a view is not yet supported for (int32 i = count - 1; i >= 0; i--) {
// in the app_server. if (BView* view = _FindView((int32)tokens.ItemAtFast(i)))
view->_DrawAfterChildren(updateRect);
}
//printf(" %ld views drawn, total Draw() time: %lld\n", count, drawTime); //printf(" %ld views drawn, total Draw() time: %lld\n", count, drawTime);
} }
+29 -19
View File
@@ -902,11 +902,15 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
InvalidateScreenClipping(); InvalidateScreenClipping();
if (dirty->CountRects() > 0) { if (dirty->CountRects() > 0) {
// exclude children, they are expected to if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
// include their own dirty regions in ParentResized() // exclude children, they are expected to
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { // include their own dirty regions in ParentResized()
if (child->IsVisible()) { for (ViewLayer* child = FirstChild(); child;
IntRect previousChildVisible(child->Frame() & oldBounds & Bounds()); child = child->NextSibling()) {
if (!child->IsVisible())
continue;
IntRect previousChildVisible(
child->Frame() & oldBounds & Bounds());
if (dirty->Frame().Intersects(previousChildVisible)) { if (dirty->Frame().Intersects(previousChildVisible)) {
dirty->Exclude((clipping_rect)previousChildVisible); dirty->Exclude((clipping_rect)previousChildVisible);
} }
@@ -1476,21 +1480,27 @@ ViewLayer::RebuildClipping(bool deep)
fLocalClipping.Set((clipping_rect)Bounds()); fLocalClipping.Set((clipping_rect)Bounds());
if (ViewLayer* child = FirstChild()) { if (ViewLayer* child = FirstChild()) {
BRegion* childrenRegion = fWindow->GetRegion(); // if this view does not draw over children,
if (!childrenRegion)
return;
// exclude all children from the clipping // exclude all children from the clipping
for (; child; child = child->NextSibling()) { if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
if (child->IsVisible()) BRegion* childrenRegion = fWindow->GetRegion();
childrenRegion->Include((clipping_rect)child->Frame()); if (!childrenRegion)
return;
if (deep)
child->RebuildClipping(deep); for (; child; child = child->NextSibling()) {
if (child->IsVisible())
childrenRegion->Include((clipping_rect)child->Frame());
}
fLocalClipping.Exclude(childrenRegion);
fWindow->RecycleRegion(childrenRegion);
}
// if the operation is "deep", make children rebuild their
// clipping too
if (deep) {
for (child = FirstChild(); child; child = child->NextSibling())
child->RebuildClipping(true);
} }
fLocalClipping.Exclude(childrenRegion);
fWindow->RecycleRegion(childrenRegion);
} }
// add the user clipping in case there is one // add the user clipping in case there is one
@@ -1520,7 +1530,7 @@ ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
fScreenClipping = fLocalClipping; fScreenClipping = fLocalClipping;
ConvertToScreen(&fScreenClipping); ConvertToScreen(&fScreenClipping);
// see if we parts of our bounds are hidden underneath // see if parts of our bounds are hidden underneath
// the parent, the local clipping does not account for this // the parent, the local clipping does not account for this
IntRect clippedBounds = Bounds(); IntRect clippedBounds = Bounds();
ConvertToVisibleInTopView(&clippedBounds); ConvertToVisibleInTopView(&clippedBounds);
+1 -1
View File
@@ -241,7 +241,7 @@ class ViewLayer {
int32 fToken; int32 fToken;
// area within parent coordinate space // area within parent coordinate space
IntRect fFrame; IntRect fFrame;
// scrolling offset // offset of the local area (bounds)
IntPoint fScrollingOffset; IntPoint fScrollingOffset;
rgb_color fViewColor; rgb_color fViewColor;