diff --git a/src/tests/servers/app/newClipping/Clipping.proj b/src/tests/servers/app/newClipping/Clipping.proj index 9a9b1e31c4..b87e60b2be 100644 Binary files a/src/tests/servers/app/newClipping/Clipping.proj and b/src/tests/servers/app/newClipping/Clipping.proj differ diff --git a/src/tests/servers/app/newClipping/Layer.cpp b/src/tests/servers/app/newClipping/Layer.cpp index 844a8d325f..105db320ab 100644 --- a/src/tests/servers/app/newClipping/Layer.cpp +++ b/src/tests/servers/app/newClipping/Layer.cpp @@ -255,11 +255,11 @@ Layer::resize_layer_frame_by(float x, float y) { float dx, dy; - fFrame = newFrame; - dx = newFrame.Width() - fFrame.Width(); dy = newFrame.Height() - fFrame.Height(); + fFrame = newFrame; + if (dx != 0.0f || dy != 0.0f) { // call hook function @@ -284,12 +284,32 @@ Layer::rezize_layer_redraw_more(BRegion ®, float dx, float dy) { uint16 rm = lay->fResizeMode & 0x0000FFFF; + if ((rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) + { + + BRect oldBounds(lay->Bounds()); + oldBounds.right -=dx; + oldBounds.bottom -=dy; + + BRegion regZ(lay->Bounds()); + regZ.Include(oldBounds); + regZ.Exclude(oldBounds&lay->Bounds()); + + lay->ConvertToScreen2(®Z); + + reg.IntersectWith(&lay->fFullVisible); + + reg.Include(®Z); + + lay->rezize_layer_redraw_more(reg, dx, dy); +// above OR this: +// reg.Include(&lay->fFullVisible); + } + else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) || ((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) || ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)|| - ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0) || - // TODO: these 2 don't need to be redrawn entirely. but ATM we don't have a choice - (rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) + ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0)) { reg.Include(&lay->fFullVisible); } @@ -306,17 +326,20 @@ Layer::rezize_layer_redraw_more(BRegion &redraw, BRegion ©, float dx, float if ((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) { - copy.Include(&lay->fFullVisible); +// copy.Include(&lay->fFullVisible); redraw.Include(&lay->fFullVisible); } else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) || ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0) || - ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0) || - // TODO: these 2 don't need to be redrawn entirely. but ATM we don't have a choice - (rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) + ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0)) { redraw.Include(&lay->fFullVisible); } + else if ((rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) + { + lay->rezize_layer_redraw_more(redraw, copy, dx, dy); +// redraw.Include(&lay->fFullVisible); + } } } @@ -339,9 +362,6 @@ Layer::ResizeBy(float dx, float dy) BRegion oldFullVisible(fFullVisible); BRegion oldVisible(fVisible); -// OPT: you can use HW acceleration for either for bottom alligned layer or -// for right alligned ones. investigate! - // right, center and bottom alligned layers will change their position // so we need to invalidate their current visible regions // BRegion redrawRightOrBottom; diff --git a/src/tests/servers/app/newClipping/main.cpp b/src/tests/servers/app/newClipping/main.cpp index a133be8909..d5402a49a3 100644 --- a/src/tests/servers/app/newClipping/main.cpp +++ b/src/tests/servers/app/newClipping/main.cpp @@ -139,8 +139,10 @@ void clsMainWindow::test1() c.green = rand()/256; c.blue = rand()/256; Layer *lay102 = new Layer(BRect(200,20,420,250), "lay102", - B_FOLLOW_NONE, - B_FULL_UPDATE_ON_RESIZE, c); +// B_FOLLOW_NONE, + B_FOLLOW_TOP_BOTTOM, +// B_FULL_UPDATE_ON_RESIZE, c); + 0, c); lay1->AddLayer(lay102); c.red = rand()/256;