Skip to content

Commit

Permalink
Merge pull request #27 from Newstex/pull-requests/no-upscaling
Browse files Browse the repository at this point in the history
Avoid upscaling images smaller than -imageSize
  • Loading branch information
Olivier Poitrey committed Feb 15, 2013
2 parents 638cf4d + 6ed581d commit 5cef1fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SDSegmentedControl.m
Expand Up @@ -954,7 +954,8 @@ - (UIImage *)scaledImageWithImage:(UIImage*)image
{
if (!image) return nil;

if (!CGSizeEqualToSize(image.size, self.imageSize))
// Scale down images that are too large
if (image.size.width > self.imageSize.width || image.size.height > self.imageSize.height)
{
UIImageView *imageView = [UIImageView.alloc initWithFrame:CGRectMake(0, 0, self.imageSize.width, self.imageSize.height)];
imageView.contentMode = UIViewContentModeScaleAspectFit;
Expand Down

0 comments on commit 5cef1fb

Please sign in to comment.