quick fix for windows resizing/moving at fractional offsets, fix for bitmap drawing placement, small clean ups
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12961 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
683be71e08
commit
457820a6ef
@ -149,7 +149,6 @@ void
|
||||
Layer::AddChild(Layer* layer, ServerWindow* serverWin)
|
||||
{
|
||||
STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName()));
|
||||
//printf("Layer(%s)::AddChild(%s)\n", GetName(), layer->GetName());
|
||||
|
||||
if (layer->fParent != NULL) {
|
||||
printf("ERROR: AddChild(): Layer already has a parent\n");
|
||||
@ -956,7 +955,7 @@ Layer::MoveBy(float x, float y)
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
BPortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_MOVE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
@ -972,13 +971,12 @@ Layer::ResizeBy(float x, float y)
|
||||
{
|
||||
STRACE(("Layer(%s)::ResizeBy() START\n", GetName()));
|
||||
|
||||
if(!fParent)
|
||||
{
|
||||
if (!fParent) {
|
||||
printf("ERROR: in Layer::ResizeBy()! - No parent!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
BPortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_RESIZE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
|
@ -1521,10 +1521,9 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
||||
if (sbmp) {
|
||||
|
||||
BRect src = sbmp->Bounds();
|
||||
BRect dst = fCurrentLayer->fParent->ConvertFromParent(fCurrentLayer->fFull.Frame());
|
||||
dst.OffsetBy(point);
|
||||
BRect dst = src.OffsetToCopy(point);
|
||||
dst = fCurrentLayer->ConvertToTop(dst);
|
||||
|
||||
fCurrentLayer->GetDisplayDriver()->DrawBitmap(sbmp, src, dst, fCurrentLayer->fLayerData);
|
||||
}
|
||||
@ -1543,10 +1542,9 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
||||
if (sbmp) {
|
||||
|
||||
BRect src = sbmp->Bounds();
|
||||
BRect dst = fCurrentLayer->fParent->ConvertFromParent(fCurrentLayer->fFull.Frame());
|
||||
dst.OffsetBy(point);
|
||||
BRect dst = src.OffsetToCopy(point);
|
||||
dst = fCurrentLayer->ConvertToTop(dst);
|
||||
|
||||
fCurrentLayer->GetDisplayDriver()->DrawBitmap(sbmp, src, dst, fCurrentLayer->fLayerData);
|
||||
}
|
||||
@ -1564,10 +1562,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
||||
if (sbmp) {
|
||||
BRect dst = fCurrentLayer->fParent->ConvertFromParent(fCurrentLayer->fFull.Frame());
|
||||
dstRect.OffsetBy(dst.left, dst.top);
|
||||
// TODO: why is this not working:
|
||||
// fCurrentLayer->ConvertToTop(dstRect);
|
||||
dstRect = fCurrentLayer->ConvertToTop(dstRect);
|
||||
|
||||
fCurrentLayer->GetDisplayDriver()->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->fLayerData);
|
||||
}
|
||||
@ -1587,10 +1582,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
||||
if (sbmp) {
|
||||
BRect dst = fCurrentLayer->fParent->ConvertFromParent(fCurrentLayer->fFull.Frame());
|
||||
dstRect.OffsetBy(dst.left, dst.top);
|
||||
// TODO: why is this not working:
|
||||
// fCurrentLayer->ConvertToTop(dstRect);
|
||||
dstRect = fCurrentLayer->ConvertToTop(dstRect);
|
||||
|
||||
fCurrentLayer->GetDisplayDriver()->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->fLayerData);
|
||||
}
|
||||
|
@ -340,6 +340,9 @@ WinBorder::Draw(const BRect &r)
|
||||
void
|
||||
WinBorder::MoveBy(float x, float y)
|
||||
{
|
||||
x = (float)int32(x);
|
||||
y = (float)int32(y);
|
||||
|
||||
if (x == 0.0 && y == 0.0)
|
||||
return;
|
||||
|
||||
@ -392,6 +395,9 @@ WinBorder::ResizeBy(float x, float y)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::ResizeBy()\n", GetName()));
|
||||
|
||||
x = (float)int32(x);
|
||||
y = (float)int32(y);
|
||||
|
||||
float wantWidth = fFrame.Width() + x;
|
||||
float wantHeight = fFrame.Height() + y;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user