Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #149 from indragiek/prefix-capinsets
Browse files Browse the repository at this point in the history
Prefix the capInsets property
  • Loading branch information
jspahrsummers committed Oct 14, 2014
2 parents db856d0 + 32d0f38 commit 1417edc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Rebel/NSImage+RBLResizableImageAdditions.m
Expand Up @@ -15,7 +15,7 @@ - (RBLResizableImage *)rbl_resizableImageWithCapInsets:(NSEdgeInsets)capInsets {
RBLResizableImage *image = [[RBLResizableImage alloc] initWithSize:self.size];
[image addRepresentations:self.representations];

image.capInsets = capInsets;
image.rbl_capInsets = capInsets;
return image;
}

Expand Down
2 changes: 1 addition & 1 deletion Rebel/RBLResizableImage.h
Expand Up @@ -18,6 +18,6 @@
//
// Any portion of the image not covered by end caps will be tiled when the image
// is drawn.
@property (nonatomic, assign) NSEdgeInsets capInsets;
@property (nonatomic, assign) NSEdgeInsets rbl_capInsets;

@end
20 changes: 10 additions & 10 deletions Rebel/RBLResizableImage.m
Expand Up @@ -32,7 +32,7 @@ - (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSComposi
CGFloat widthScale = CGImageGetWidth(image) / self.size.width;
CGFloat heightScale = CGImageGetHeight(image) / self.size.height;

NSEdgeInsets insets = self.capInsets;
NSEdgeInsets insets = self.rbl_capInsets;

// TODO: Cache the nine-part images for this common case of wanting to draw
// the whole source image.
Expand Down Expand Up @@ -147,7 +147,7 @@ - (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSComposi

- (id)copyWithZone:(NSZone *)zone {
RBLResizableImage *image = [super copyWithZone:zone];
image.capInsets = self.capInsets;
image.rbl_capInsets = self.rbl_capInsets;
return image;
}

Expand All @@ -157,7 +157,7 @@ - (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self == nil) return nil;

self.capInsets = NSEdgeInsetsMake(
self.rbl_capInsets = NSEdgeInsetsMake(
[coder decodeDoubleForKey:@"capInsetTop"],
[coder decodeDoubleForKey:@"capInsetLeft"],
[coder decodeDoubleForKey:@"capInsetBottom"],
Expand All @@ -170,10 +170,10 @@ - (id)initWithCoder:(NSCoder *)coder {
- (void)encodeWithCoder:(NSCoder *)coder {
[super encodeWithCoder:coder];

[coder encodeDouble:self.capInsets.top forKey:@"capInsetTop"];
[coder encodeDouble:self.capInsets.left forKey:@"capInsetLeft"];
[coder encodeDouble:self.capInsets.bottom forKey:@"capInsetBottom"];
[coder encodeDouble:self.capInsets.right forKey:@"capInsetRight"];
[coder encodeDouble:self.rbl_capInsets.top forKey:@"capInsetTop"];
[coder encodeDouble:self.rbl_capInsets.left forKey:@"capInsetLeft"];
[coder encodeDouble:self.rbl_capInsets.bottom forKey:@"capInsetBottom"];
[coder encodeDouble:self.rbl_capInsets.right forKey:@"capInsetRight"];
}

#pragma mark NSObject
Expand All @@ -183,8 +183,8 @@ - (BOOL)isEqual:(RBLResizableImage *)image {
if (![image isKindOfClass:RBLResizableImage.class]) return NO;
if (![super isEqual:image]) return NO;

NSEdgeInsets a = self.capInsets;
NSEdgeInsets b = image.capInsets;
NSEdgeInsets a = self.rbl_capInsets;
NSEdgeInsets b = image.rbl_capInsets;

if (fabs(a.left - b.left) > 0.1) return NO;
if (fabs(a.top - b.top) > 0.1) return NO;
Expand All @@ -195,7 +195,7 @@ - (BOOL)isEqual:(RBLResizableImage *)image {
}

- (NSString *)description {
NSEdgeInsets insets = self.capInsets;
NSEdgeInsets insets = self.rbl_capInsets;
return [NSString stringWithFormat:@"<%@: %p>{ size = %@, capInsets = (%f, %f, %f, %f) }", self.class, self, NSStringFromSize(self.size), insets.top, insets.left, insets.bottom, insets.right];
}

Expand Down

0 comments on commit 1417edc

Please sign in to comment.