gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: NSView patch


From: Fred Kiefer
Subject: Re: Fwd: NSView patch
Date: Mon, 23 Feb 2009 17:50:00 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Matt Rice wrote:
> On Mon, Feb 23, 2009 at 5:50 AM, Fred Kiefer <address@hidden> wrote:
>> The other problem that we sometimes mark subviews as still needing
>> display due to rounding errors should be addressed. Here it would be
>> helpful to get the detailed values of the involved rectangles. These
>> surely are in Matts gdb log, but as he is using a changed version of the
>> NSView code it is hard for me to tell, which is which. What would help
>> is to have the values of _visibleRect, _invalidRect and aRect at the
>> beginning of the method displayRectIgnoringOpacity:inContext:
> 
> the superview at the beginning of the method.
> 
> Breakpoint 2, -[NSView displayRectIgnoringOpacity:inContext:]
> (self=0x276ff90, _cmd=0xdc4e70, aRect={origin = {x = 0, y = 0}, size =
> {width = 476, height = 381}}, context=0x299b740) at NSView.m:2368
> 2368      BOOL flush = NO;
> $_invalidRect ={origin = {x = 0, y = 0}, size = {width = 1, height = 1}}
> $_visibleRect ={origin = {x = 0, y = 0}, size = {width = 476, height = 381}}
> $aRect ={origin = {x = 0, y = 0}, size = {width = 476, height = 381}}
> 
> still in the super-view but right before we go to the subview...
> 
> Breakpoint 3, -[NSView displayRectIgnoringOpacity:inContext:]
> (self=0x276ff90, _cmd=0xdc4e70, aRect={origin = {x = 0, y = 0}, size =
> {width = 476, height = 381}}, context=0x299b740) at NSView.m:2450
> 2450                  if (NSIsEmptyRect(isect) == NO)
> $_invalidRect ={origin = {x = 0, y = 0}, size = {width = 0, height = 0}}
> $_visibleRect ={origin = {x = 0, y = 0}, size = {width = 476, height = 381}}
> $aRect ={origin = {x = 0, y = 0}, size = {width = 476, height = 381}}
> $isect ={origin = {x = 48.7490425, y = 192.641785}, size = {width =
> 118, height = 54}}
> $subviewFrame ={origin = {x = 48.7490425, y = 192.641785}, size =
> {width = 118, height = 54}}
> 
> right after we go
> isect = [subview convertRect: isect fromView: self];
> 
> Breakpoint 4, -[NSView displayRectIgnoringOpacity:inContext:]
> (self=0x276ff90, _cmd=0xdc4e70, aRect={origin = {x = 0, y = 0}, size =
> {width = 476, height = 381}}, context=0x299b740) at NSView.m:2453
> 2453                      [subview displayRectIgnoringOpacity: isect
> inContext: context];
> $new_isect ={origin = {x = 0, y = 0}, size = {width = 117.999985, height = 
> 54}}
> 
> 
> now here in the view where the error occurs
> 
> Breakpoint 2, -[NSView displayRectIgnoringOpacity:inContext:]
> (self=0x284f7e0, _cmd=0xdc4e70, aRect={origin = {x = 0, y = 0}, size =
> {width = 117.999985, height = 54}}, context=0x299b740) at
> NSView.m:2368
> 2368      BOOL flush = NO;
> $_invalidRect ={origin = {x = 0, y = 0}, size = {width = 118, height = 54}}
> $_visibleRect ={origin = {x = 0, y = 0}, size = {width = 118, height = 54}}
> $aRect ={origin = {x = 0, y = 0}, size = {width = 117.999985, height = 54}}
> 
> Breakpoint 1, gsbp () at NSView.m:2362
> 

Thank you for checking all these values. It is really just a small
rounding error in the conversion. What about cheating here? For this
special case the simplest solution would be to use the bounds rectangle
of the sub view as new isect, when the real isect before the conversion
is equal to the frame rect of the sub view.
I know this will not help us in all cases, but it would quite often save
us the computation of the conversion and in this specific case it is
also more correct.

The code would look somewhat like this, plus plenty of comments
explaining why we do this:

              isect = NSIntersectionRect(aRect, subviewFrame);
              if (NSIsEmptyRect(isect) == NO)
                {
                  if (NSEqualRects(isect, subviewFrame) == YES)
                    isect = [subview bounds];
                  else
                    isect = [subview convertRect: isect fromView: self];
                  [subview displayRectIgnoringOpacity: isect inContext:
context];
                }

The main problem here is that somebody will have to convince me that
this is correct in all cases, even with scaling and rotation.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]