gnustep-dev
[Top][All Lists]
Advanced

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

Re: Can we have convertTo/FromBase in view?


From: Banlu Kemiyatorn
Subject: Re: Can we have convertTo/FromBase in view?
Date: Sun, 26 Dec 2010 03:05:51 +0700

On Sun, Dec 26, 2010 at 12:33 AM, Quentin Mathé <address@hidden> wrote:
>
> NSView conversion methods requires both the receiver view and the argument 
> view to be in the same view hierarchy (the Apple doc states they must belong 
> to the same window).

I kinda use misguiding word, different hierarchy means they are not in
the same branch, only share an ancestor.


> It's unclear to me why GNUstep uses these two matrices 'fromWindow' and 
> 'toWindow' per view rather than just having a 'superviewBoundsToFrame' matrix 
> and a 'frameToBounds' matrix. Most UI toolkits seems to use this approach in 
> their view hierararchy equivalent. I think it's more easy to debug geometry 
> issues this way, and the drawing code would do less conversions when the view 
> hierarchy is redrawn (based on what I remember from the NSView drawing code 
> the last time I looked at it). Some cases would be more costly like 
> invalidating drawing areas, but based on some tests I have done, this is 
> negligible even with a complex view hierarchy and many invalidations, when 
> compared to the time spent in the geometry conversions during a recursive 
> redraw.
> Am I overlooking something or are there some special advantages with the 
> current approach?

Not sure I understand this correctly, I think if you didn't store
fromWindow, toWindow and store conversion and inversion to superview,
then to convert a point you may need to keep multiplying a few
superviews until it reach the root, which could be a few matrix
multiplications. But most likely views are pretty static. In some 3D
engines I found they often cache local to base transformations, with
mark dirty scheme.

Banlu
-- 
    .----.     Banlu Kemiyatorn
  /.../\...\   漫画家
 |.../  \...|  http://qstx.blogspot.com (Free Software Advocacy & Development)
 |../    \..|  http://feedbat.blogspot.com (Studio Work For Hire)
  \/      \/   http://groundzerostudiocomplex.blogspot.com (Studio Research)



reply via email to

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