gnustep-dev
[Top][All Lists]
Advanced

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

NSView caching of isFlipped


From: Derek Fawcus
Subject: NSView caching of isFlipped
Date: Fri, 30 Jul 2010 15:10:16 -0700
User-agent: Mutt/1.4.2.3i

I came across an interesting effect due to the above,  namely a
flipped view with the incorrect behaviour.

This was in part defined as:

@interface TextView: NSView
{
        BOOL _flipped;
        /* other fields ... */
}
- (id) initWithFrame:(NSRect)frameRect andStorage:(NSTextStorage *)storage 
isFlipped:(BOOL)flipped;
@end

@implementation TextView
- (BOOL)isFlipped
{
        return _flipped;
}

- (id)initWithFrame:(NSRect)frameRect
         andStorage:(NSTextStorage *)storage
         isFlipped:(BOOL)flipped
{
        if (![super initWithFrame:(NSRect)frameRect])
                return nil;

        _flipped = flipped;

        /* other stuff ... */
}

Then due to the effect of +alloc (zeros memory) and the above,
any view which was supposed to be flipped was not.
After spending quite a bit of time trying to figure out why the
program did not operate correctly on GS,  whereas it did no OSX
and OPENSTEP,  the workaround was eventually simple,  namely to
move the assignment before the [super initWithFrame].

So - how much of a performance gain do we get from caching the
flipped status in NSView?  If it is significant,  then is there
any way that the value could be sampled upon the first message
sent _after_ init?  Or should the caching simply be removed?

DF



reply via email to

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