From 53fca955e6ca4c19cd29540b562dc92eaf8d7787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 26 Aug 2007 12:58:20 +0000 Subject: [PATCH] * 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 --- src/kits/interface/View.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 77edddf11d..d4472c034c 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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();