Source/Bit.m
changeset 1 3eb7be1dd7b6
parent 0 e9f7ba4718e1
child 7 428a194e3e59
     1.1 --- a/Source/Bit.m	Fri Mar 07 11:43:02 2008 -0800
     1.2 +++ b/Source/Bit.m	Mon Mar 10 17:30:57 2008 -0700
     1.3 @@ -30,43 +30,11 @@
     1.4  
     1.5  - (id) copyWithZone: (NSZone*)zone
     1.6  {
     1.7 -    // NSLayer isn't copyable, but it is archivable. So create a copy by archiving to
     1.8 -    // a temporary data block, then unarchiving a new layer from that block.
     1.9 -    
    1.10 -    // One complication is that, due to a bug in Core Animation, CALayer can't archive
    1.11 -    // a pattern-based CGColor. So as a workaround, clear the background before archiving,
    1.12 -    // then restore it afterwards.
    1.13 -    
    1.14 -    // Also, archiving a CALayer with an image in it leaks memory. (Filed as rdar://5786865 )
    1.15 -    // As a workaround, clear the contents before archiving, then restore.
    1.16 -    
    1.17 -    CGColorRef bg = CGColorRetain(self.backgroundColor);
    1.18 -    self.backgroundColor = NULL;
    1.19 -    id contents = [self.contents retain];
    1.20 -    self.contents = nil;
    1.21 -    
    1.22 -    NSData *data = [NSKeyedArchiver archivedDataWithRootObject: self];
    1.23 -    
    1.24 -    self.backgroundColor = bg;
    1.25 -    self.contents = contents;
    1.26 -
    1.27 -    Bit *clone = [NSKeyedUnarchiver unarchiveObjectWithData: data];
    1.28 -    clone.backgroundColor = bg;
    1.29 -    clone.contents = contents;
    1.30 -    CGColorRelease(bg);
    1.31 -    [contents release];
    1.32 -
    1.33 -    clone->_owner = _owner;             // _owner is not archived
    1.34 -    return [clone retain];
    1.35 +    Bit *clone = [super copyWithZone: zone];
    1.36 +    clone->_owner = _owner;
    1.37 +    return clone;
    1.38  }
    1.39  
    1.40 -
    1.41 -- (NSString*) description
    1.42 -{
    1.43 -    return [NSString stringWithFormat: @"%@[(%g,%g)]", self.class,self.position.x,self.position.y];
    1.44 -}
    1.45 -
    1.46 -
    1.47  @synthesize owner=_owner;
    1.48  
    1.49  - (BOOL) isFriendly         {return _owner.friendly;}
    1.50 @@ -124,9 +92,11 @@
    1.51          }
    1.52          
    1.53          self.zPosition = z;
    1.54 +#if !TARGET_OS_ASPEN
    1.55          self.shadowOpacity = shadow;
    1.56          self.shadowOffset = CGSizeMake(offset,-offset);
    1.57          self.shadowRadius = radius;
    1.58 +#endif
    1.59          self.opacity = opacity;
    1.60          self.scale *= scale;
    1.61      }