diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index 3d5b69c6f7..1a014bc527 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -565,6 +565,8 @@ private: void _UpdateStateForRemove(); void _UpdatePattern(::pattern pattern); + void _FlushIfNotInTransaction(); + bool _CreateSelf(); bool _AddChildToList(BView* child, BView* before = NULL); bool _RemoveChildFromList(BView* child); diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 8183e11a3f..ff62c98595 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1013,7 +1013,7 @@ BView::SetViewCursor(const BCursor *cursor, bool sync) void -BView::Flush(void) const +BView::Flush() const { if (fOwner) fOwner->Flush(); @@ -1021,7 +1021,7 @@ BView::Flush(void) const void -BView::Sync(void) const +BView::Sync() const { do_owner_check_no_pick(); if (fOwner) @@ -2240,6 +2240,8 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect) fOwner->fLink->Attach(bitmap->get_server_token()); fOwner->fLink->Attach(dstRect); fOwner->fLink->Attach(srcRect); + + _FlushIfNotInTransaction(); } } @@ -2273,6 +2275,8 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BPoint where) BRect dst = src.OffsetToCopy(where); fOwner->fLink->Attach(dst); fOwner->fLink->Attach(src); + + _FlushIfNotInTransaction(); } } @@ -2373,6 +2377,8 @@ BView::DrawString(const char *string, int32 length, BPoint location, fOwner->fLink->AttachString(string, length); + _FlushIfNotInTransaction(); + // this modifies our pen location, so we invalidate the flag. fState->valid_flags &= ~B_VIEW_PEN_LOCATION_BIT; } @@ -2399,6 +2405,8 @@ BView::StrokeEllipse(BRect rect, ::pattern pattern) fOwner->fLink->StartMessage(AS_STROKE_ELLIPSE); fOwner->fLink->Attach(rect); + + _FlushIfNotInTransaction(); } @@ -2422,6 +2430,8 @@ BView::FillEllipse(BRect rect, ::pattern pattern) fOwner->fLink->StartMessage(AS_FILL_ELLIPSE); fOwner->fLink->Attach(rect); + + _FlushIfNotInTransaction(); } @@ -2448,6 +2458,8 @@ BView::StrokeArc(BRect rect, float startAngle, float arcAngle, fOwner->fLink->Attach(rect); fOwner->fLink->Attach(startAngle); fOwner->fLink->Attach(arcAngle); + + _FlushIfNotInTransaction(); } @@ -2474,6 +2486,8 @@ BView::FillArc(BRect rect, float startAngle, float arcAngle, fOwner->fLink->Attach(rect); fOwner->fLink->Attach(startAngle); fOwner->fLink->Attach(arcAngle); + + _FlushIfNotInTransaction(); } @@ -2491,6 +2505,8 @@ BView::StrokeBezier(BPoint *controlPoints, ::pattern pattern) fOwner->fLink->Attach(controlPoints[1]); fOwner->fLink->Attach(controlPoints[2]); fOwner->fLink->Attach(controlPoints[3]); + + _FlushIfNotInTransaction(); } @@ -2508,6 +2524,8 @@ BView::FillBezier(BPoint *controlPoints, ::pattern pattern) fOwner->fLink->Attach(controlPoints[1]); fOwner->fLink->Attach(controlPoints[2]); fOwner->fLink->Attach(controlPoints[3]); + + _FlushIfNotInTransaction(); } @@ -2552,6 +2570,8 @@ BView::StrokePolygon(const BPoint *ptArray, int32 numPoints, BRect bounds, fOwner->fLink->Attach(closed); fOwner->fLink->Attach(polygon.fCount); fOwner->fLink->Attach(polygon.fPts, polygon.fCount * sizeof(BPoint)); + + _FlushIfNotInTransaction(); } else { // TODO: send via an area fprintf(stderr, "ERROR: polygon to big for BPortLink!\n"); @@ -2575,6 +2595,8 @@ BView::FillPolygon(const BPolygon *polygon, ::pattern pattern) fOwner->fLink->Attach(polygon->Frame()); fOwner->fLink->Attach(polygon->fCount); fOwner->fLink->Attach(polygon->fPts, polygon->fCount * sizeof(BPoint)); + + _FlushIfNotInTransaction(); } else { // TODO: send via an area fprintf(stderr, "ERROR: polygon to big for BPortLink!\n"); @@ -2618,6 +2640,8 @@ BView::StrokeRect(BRect rect, ::pattern pattern) fOwner->fLink->StartMessage(AS_STROKE_RECT); fOwner->fLink->Attach(rect); + + _FlushIfNotInTransaction(); } @@ -2632,6 +2656,8 @@ BView::FillRect(BRect rect, ::pattern pattern) fOwner->fLink->StartMessage(AS_FILL_RECT); fOwner->fLink->Attach(rect); + + _FlushIfNotInTransaction(); } @@ -2649,6 +2675,8 @@ BView::StrokeRoundRect(BRect rect, float xRadius, float yRadius, fOwner->fLink->Attach(rect); fOwner->fLink->Attach(xRadius); fOwner->fLink->Attach(yRadius); + + _FlushIfNotInTransaction(); } @@ -2667,6 +2695,8 @@ BView::FillRoundRect(BRect rect, float xRadius, float yRadius, fOwner->fLink->Attach(rect); fOwner->fLink->Attach(xRadius); fOwner->fLink->Attach(yRadius); + + _FlushIfNotInTransaction(); } @@ -2688,6 +2718,8 @@ BView::FillRegion(BRegion *region, ::pattern pattern) for (int32 i = 0; i < count; i++) fOwner->fLink->Attach(region->RectAt(i)); + + _FlushIfNotInTransaction(); } else { // TODO: send via area } @@ -2710,6 +2742,8 @@ BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, fOwner->fLink->Attach(pt2); fOwner->fLink->Attach(pt3); fOwner->fLink->Attach(bounds); + + _FlushIfNotInTransaction(); } @@ -2806,6 +2840,8 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, fOwner->fLink->Attach(pt2); fOwner->fLink->Attach(pt3); fOwner->fLink->Attach(bounds); + + _FlushIfNotInTransaction(); } @@ -2829,6 +2865,8 @@ BView::StrokeLine(BPoint pt0, BPoint pt1, ::pattern pattern) fOwner->fLink->Attach(pt0); fOwner->fLink->Attach(pt1); + _FlushIfNotInTransaction(); + // this modifies our pen location, so we invalidate the flag. fState->valid_flags &= ~B_VIEW_PEN_LOCATION_BIT; } @@ -2854,6 +2892,8 @@ BView::StrokeShape(BShape *shape, ::pattern pattern) fOwner->fLink->Attach(sd->ptCount); fOwner->fLink->Attach(sd->opList, sd->opCount * sizeof(uint32)); fOwner->fLink->Attach(sd->ptList, sd->ptCount * sizeof(BPoint)); + + _FlushIfNotInTransaction(); } else { // TODO: send via an area } @@ -2880,6 +2920,8 @@ BView::FillShape(BShape *shape, ::pattern pattern) fOwner->fLink->Attach(sd->ptCount); fOwner->fLink->Attach(sd->opList, sd->opCount * sizeof(int32)); fOwner->fLink->Attach(sd->ptList, sd->ptCount * sizeof(BPoint)); + + _FlushIfNotInTransaction(); } else { // TODO: send via an area // BTW, in a perfect world, the fLink API would take care of that -- axeld. @@ -2951,6 +2993,8 @@ BView::EndLineArray() fOwner->fLink->Attach(comm->count); fOwner->fLink->Attach(comm->array, comm->count * sizeof(_array_hdr_)); + _FlushIfNotInTransaction(); + delete [] comm->array; delete comm; comm = NULL; @@ -3096,6 +3140,8 @@ BView::CopyBits(BRect src, BRect dst) fOwner->fLink->StartMessage(AS_LAYER_COPY_BITS); fOwner->fLink->Attach(src); fOwner->fLink->Attach(dst); + + _FlushIfNotInTransaction(); } } @@ -3153,6 +3199,8 @@ BView::DrawPictureAsync(const BPicture *picture, BPoint where) fOwner->fLink->StartMessage(AS_LAYER_DRAW_PICTURE); fOwner->fLink->Attach(picture->token); fOwner->fLink->Attach(where); + + _FlushIfNotInTransaction(); } } @@ -3217,6 +3265,8 @@ BView::InvertRect(BRect rect) fOwner->fLink->StartMessage(AS_LAYER_INVERT_RECT); fOwner->fLink->Attach(rect); + + _FlushIfNotInTransaction(); } } @@ -4231,6 +4281,15 @@ BView::_UpdatePattern(::pattern pattern) } +void +BView::_FlushIfNotInTransaction() +{ + if (!fOwner->fInTransaction) { + fOwner->Flush(); + } +} + + BShelf * BView::_Shelf() const {