DeskCalc: Resize a bit more efficiently.
Remove B_FULL_UPDATE_ON_RESIZE flag from view. We already Invalidate() on FrameResized() which redraws the view on resize for us. This reduces the number of times Draw() is called from 3+ in some cases to just one. Unfortunately Draw() is still called multiple times in some cases producing noticable flickering and drawing artifacts but it is marginally better.
This commit is contained in:
parent
49620f7b7d
commit
786b0f8f1e
@ -117,8 +117,7 @@ CalcView::Instantiate(BMessage* archive)
|
|||||||
|
|
||||||
CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings)
|
CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings)
|
||||||
:
|
:
|
||||||
BView(frame, "DeskCalc", B_FOLLOW_ALL_SIDES,
|
BView(frame, "DeskCalc", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS),
|
||||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS),
|
|
||||||
fColumns(5),
|
fColumns(5),
|
||||||
fRows(4),
|
fRows(4),
|
||||||
|
|
||||||
@ -847,14 +846,19 @@ CalcView::SetKeypadMode(uint8 mode)
|
|||||||
|
|
||||||
if (width < kMinimumWidthScientific)
|
if (width < kMinimumWidthScientific)
|
||||||
width = kMinimumWidthScientific;
|
width = kMinimumWidthScientific;
|
||||||
if (width > kMaximumWidthScientific)
|
else if (width > kMaximumWidthScientific)
|
||||||
width = kMaximumWidthScientific;
|
width = kMaximumWidthScientific;
|
||||||
|
|
||||||
if (height < kMinimumHeightScientific)
|
if (height < kMinimumHeightScientific)
|
||||||
height = kMinimumHeightScientific;
|
height = kMinimumHeightScientific;
|
||||||
if (height > kMaximumHeightScientific)
|
else if (height > kMaximumHeightScientific)
|
||||||
height = kMaximumHeightScientific;
|
height = kMaximumHeightScientific;
|
||||||
ResizeTo(width, height);
|
|
||||||
|
if (width != fWidth || height != fHeight)
|
||||||
|
ResizeTo(width, height);
|
||||||
|
else
|
||||||
|
Invalidate();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,14 +875,18 @@ CalcView::SetKeypadMode(uint8 mode)
|
|||||||
|
|
||||||
if (width < kMinimumWidthBasic)
|
if (width < kMinimumWidthBasic)
|
||||||
width = kMinimumWidthBasic;
|
width = kMinimumWidthBasic;
|
||||||
if (width > kMaximumWidthBasic)
|
else if (width > kMaximumWidthBasic)
|
||||||
width = kMaximumWidthBasic;
|
width = kMaximumWidthBasic;
|
||||||
|
|
||||||
if (height < kMinimumHeightBasic)
|
if (height < kMinimumHeightBasic)
|
||||||
height = kMinimumHeightBasic;
|
height = kMinimumHeightBasic;
|
||||||
if (height > kMaximumHeightBasic)
|
else if (height > kMaximumHeightBasic)
|
||||||
height = kMaximumHeightBasic;
|
height = kMaximumHeightBasic;
|
||||||
ResizeTo(width, height);
|
|
||||||
|
if (width != fWidth || height != fHeight)
|
||||||
|
ResizeTo(width, height);
|
||||||
|
else
|
||||||
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user