* 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:
+20
-24
@@ -565,35 +565,30 @@ private:
|
||||
BView(const BView&);
|
||||
BView& operator=(const BView&);
|
||||
|
||||
void _InitData(BRect frame, const char* name, uint32 resizeMask,
|
||||
uint32 flags);
|
||||
status_t _SetViewBitmap(const BBitmap* bitmap,BRect srcRect,
|
||||
BRect dstRect, uint32 followFlags, uint32 options);
|
||||
void DoBezier(int32 gr, BPoint* controlPoints, pattern p);
|
||||
void DoShape(int32 gr, BShape* shape, pattern p);
|
||||
void DoPictureClip(BPicture* picture, BPoint where, bool invert,
|
||||
bool sync);
|
||||
void _InitData(BRect frame, const char* name,
|
||||
uint32 resizeMask, uint32 flags);
|
||||
status_t _SetViewBitmap(const BBitmap* bitmap,
|
||||
BRect srcRect, BRect dstRect,
|
||||
uint32 followFlags, uint32 options);
|
||||
void _ClipToPicture(BPicture* picture, BPoint where,
|
||||
bool invert, bool sync);
|
||||
|
||||
bool do_owner_check() const;
|
||||
bool do_owner_check_no_pick() const;
|
||||
void check_lock() const;
|
||||
void check_lock_no_pick() const;
|
||||
bool _CheckOwnerLockAndSwitchCurrent() const;
|
||||
bool _CheckOwnerLock() const;
|
||||
void _CheckLockAndSwitchCurrent() const;
|
||||
void _CheckLock() const;
|
||||
void _SwitchServerCurrentView() const;
|
||||
|
||||
void _SetOwner(BWindow* newOwner);
|
||||
void handle_tick();
|
||||
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;
|
||||
void _RemoveCommArray();
|
||||
|
||||
BShelf* _Shelf() const;
|
||||
void _SetShelf(BShelf* shelf);
|
||||
|
||||
void _MoveTo(int32 x, int32 y);
|
||||
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 _ConvertFromScreen(BPoint* pt, bool checkLock) const;
|
||||
@@ -605,7 +600,8 @@ private:
|
||||
void _Activate(bool state);
|
||||
void _Attach();
|
||||
void _Detach();
|
||||
void _Draw(BRect updateRect);
|
||||
void _Draw(BRect screenUpdateRect);
|
||||
void _DrawAfterChildren(BRect screenUpdateRect);
|
||||
void _Pulse();
|
||||
|
||||
void _UpdateStateForRemove();
|
||||
@@ -621,8 +617,8 @@ private:
|
||||
bool _RemoveSelf();
|
||||
|
||||
// Debugging methods
|
||||
void PrintToStream();
|
||||
void PrintTree();
|
||||
void _PrintToStream();
|
||||
void _PrintTree();
|
||||
|
||||
int32 server_token;
|
||||
uint32 fFlags;
|
||||
|
||||
+177
-172
File diff suppressed because it is too large
Load Diff
@@ -1195,11 +1195,14 @@ FrameMoved(origin);
|
||||
printf("_UPDATE_ - didn't find view by token: %ld\n", (int32)tokens.ItemAtFast(i));
|
||||
//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
|
||||
// child->DrawAfterChildren would actually work correctly,
|
||||
// only that drawing outside a view is not yet supported
|
||||
// in the app_server.
|
||||
// child->DrawAfterChildren actually works correctly
|
||||
for (int32 i = count - 1; i >= 0; i--) {
|
||||
if (BView* view = _FindView((int32)tokens.ItemAtFast(i)))
|
||||
view->_DrawAfterChildren(updateRect);
|
||||
}
|
||||
|
||||
//printf(" %ld views drawn, total Draw() time: %lld\n", count, drawTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -902,11 +902,15 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||
InvalidateScreenClipping();
|
||||
|
||||
if (dirty->CountRects() > 0) {
|
||||
// exclude children, they are expected to
|
||||
// include their own dirty regions in ParentResized()
|
||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
||||
if (child->IsVisible()) {
|
||||
IntRect previousChildVisible(child->Frame() & oldBounds & Bounds());
|
||||
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
||||
// exclude children, they are expected to
|
||||
// include their own dirty regions in ParentResized()
|
||||
for (ViewLayer* child = FirstChild(); child;
|
||||
child = child->NextSibling()) {
|
||||
if (!child->IsVisible())
|
||||
continue;
|
||||
IntRect previousChildVisible(
|
||||
child->Frame() & oldBounds & Bounds());
|
||||
if (dirty->Frame().Intersects(previousChildVisible)) {
|
||||
dirty->Exclude((clipping_rect)previousChildVisible);
|
||||
}
|
||||
@@ -1476,21 +1480,27 @@ ViewLayer::RebuildClipping(bool deep)
|
||||
fLocalClipping.Set((clipping_rect)Bounds());
|
||||
|
||||
if (ViewLayer* child = FirstChild()) {
|
||||
BRegion* childrenRegion = fWindow->GetRegion();
|
||||
if (!childrenRegion)
|
||||
return;
|
||||
|
||||
// if this view does not draw over children,
|
||||
// exclude all children from the clipping
|
||||
for (; child; child = child->NextSibling()) {
|
||||
if (child->IsVisible())
|
||||
childrenRegion->Include((clipping_rect)child->Frame());
|
||||
|
||||
if (deep)
|
||||
child->RebuildClipping(deep);
|
||||
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
||||
BRegion* childrenRegion = fWindow->GetRegion();
|
||||
if (!childrenRegion)
|
||||
return;
|
||||
|
||||
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
|
||||
@@ -1520,7 +1530,7 @@ ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
||||
fScreenClipping = fLocalClipping;
|
||||
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
|
||||
IntRect clippedBounds = Bounds();
|
||||
ConvertToVisibleInTopView(&clippedBounds);
|
||||
|
||||
@@ -241,7 +241,7 @@ class ViewLayer {
|
||||
int32 fToken;
|
||||
// area within parent coordinate space
|
||||
IntRect fFrame;
|
||||
// scrolling offset
|
||||
// offset of the local area (bounds)
|
||||
IntPoint fScrollingOffset;
|
||||
|
||||
rgb_color fViewColor;
|
||||
|
||||
Reference in New Issue
Block a user