git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13037 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-06-10 05:43:44 +00:00
parent 6102a61109
commit 4a7973e335
3 changed files with 36 additions and 14 deletions
Binary file not shown.
+32 -12
View File
@@ -255,11 +255,11 @@ Layer::resize_layer_frame_by(float x, float y)
{ {
float dx, dy; float dx, dy;
fFrame = newFrame;
dx = newFrame.Width() - fFrame.Width(); dx = newFrame.Width() - fFrame.Width();
dy = newFrame.Height() - fFrame.Height(); dy = newFrame.Height() - fFrame.Height();
fFrame = newFrame;
if (dx != 0.0f || dy != 0.0f) if (dx != 0.0f || dy != 0.0f)
{ {
// call hook function // call hook function
@@ -284,12 +284,32 @@ Layer::rezize_layer_redraw_more(BRegion &reg, float dx, float dy)
{ {
uint16 rm = lay->fResizeMode & 0x0000FFFF; 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(&regZ);
reg.IntersectWith(&lay->fFullVisible);
reg.Include(&regZ);
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) || if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) ||
((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) || ((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) ||
((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)|| ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)||
((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && 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)
{ {
reg.Include(&lay->fFullVisible); reg.Include(&lay->fFullVisible);
} }
@@ -306,17 +326,20 @@ Layer::rezize_layer_redraw_more(BRegion &redraw, BRegion &copy, float dx, float
if ((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) if ((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0)
{ {
copy.Include(&lay->fFullVisible); // copy.Include(&lay->fFullVisible);
redraw.Include(&lay->fFullVisible); redraw.Include(&lay->fFullVisible);
} }
else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) || else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) ||
((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0) || ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0) ||
((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && 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)
{ {
redraw.Include(&lay->fFullVisible); 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 oldFullVisible(fFullVisible);
BRegion oldVisible(fVisible); 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 // right, center and bottom alligned layers will change their position
// so we need to invalidate their current visible regions // so we need to invalidate their current visible regions
// BRegion redrawRightOrBottom; // BRegion redrawRightOrBottom;
+4 -2
View File
@@ -139,8 +139,10 @@ void clsMainWindow::test1()
c.green = rand()/256; c.green = rand()/256;
c.blue = rand()/256; c.blue = rand()/256;
Layer *lay102 = new Layer(BRect(200,20,420,250), "lay102", Layer *lay102 = new Layer(BRect(200,20,420,250), "lay102",
B_FOLLOW_NONE, // B_FOLLOW_NONE,
B_FULL_UPDATE_ON_RESIZE, c); B_FOLLOW_TOP_BOTTOM,
// B_FULL_UPDATE_ON_RESIZE, c);
0, c);
lay1->AddLayer(lay102); lay1->AddLayer(lay102);
c.red = rand()/256; c.red = rand()/256;