* I confirmed that on BeOS, BView::Invalidate(BRect) rounds the rect to integer

coords in this way. BRegion does a different rounding, also compatible
  with BeOS. I added an explaination. This fixes one _part_ of #1426, which is
  that Sudoku doesn't invalidate more area than intended (or at least it works
  as it does on BeOS now). The second part of the bug though is that the server
  has been preventing the drawing of lines and rects in a certain way, in another
  words, the part of the bug I fixed should not have been a problem in the first
  place if the clipping would have worked correctly. I believe the problem shows
  when the drawing commands contain fractional offsets. The rounding happens in
  the server, but maybe too late (after comparing with the clipping region). It
  could also be a bug in our BRegion implementation, I need to check my new
  implementation behaves exactly like BeOS in the Intersects() and Contains()
  methods for fractional coordinates parameters. Anyways, at least the visual
  problems are gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-08-26 12:58:20 +00:00
parent b7a5b10ad1
commit 53fca955e6

View File

@ -3311,7 +3311,20 @@ BView::DrawPictureAsync(const char *filename, long offset, BPoint where)
void
BView::Invalidate(BRect invalRect)
{
if (!invalRect.IsValid() || fOwner == NULL)
if (fOwner == NULL)
return;
// NOTE: This rounding of the invalid rect is to stay compatible with BeOS.
// On the server side, the invalid rect will be converted to a BRegion,
// which rounds in a different manner, so that it really includes the
// fractional coordinates of a BRect (ie ceilf(rect.right) &
// ceilf(rect.bottom)), which is also what BeOS does. So we have to do the
// different rounding here to stay compatible in both ways.
invalRect.left = (int)invalRect.left;
invalRect.top = (int)invalRect.top;
invalRect.right = (int)invalRect.right;
invalRect.bottom = (int)invalRect.bottom;
if (!invalRect.IsValid())
return;
check_lock();