Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Small cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Oct 10, 2012
1 parent 8ee404b commit 39bf43c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions Example/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
targetColor:[UIColor greenColor]
withIdentifier:@"pink is always good"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(0, 100, imageView.bounds.size.width, imageView.bounds.size.height);
[self.window addSubview:imageView];

[self.window makeKeyAndVisible];
Expand Down
5 changes: 2 additions & 3 deletions Source/FTPDFIconRenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ - (UIImage *)imageWithCacheIdentifier:(NSString *)identifier;
}

CGSize targetSize = self.targetSize;
CGRect targetRect = CGRectMake(0, 0, targetSize.width, targetSize.height);

UIGraphicsBeginImageContextWithOptions(targetSize, false, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
Expand All @@ -244,7 +243,7 @@ - (UIImage *)imageWithCacheIdentifier:(NSString *)identifier;
CGContextSaveGState(context);
CGPDFPageRef page = self.sourcePage;
CGRect mediaRect = self.mediaRectOfSourcePage;
CGContextScaleCTM(context, targetRect.size.width / mediaRect.size.width, targetRect.size.height / mediaRect.size.height);
CGContextScaleCTM(context, targetSize.width / mediaRect.size.width, targetSize.height / mediaRect.size.height);
CGContextTranslateCTM(context, -mediaRect.origin.x, -mediaRect.origin.y);
CGContextDrawPDFPage(context, page);
CGContextRestoreGState(context);
Expand All @@ -253,7 +252,7 @@ - (UIImage *)imageWithCacheIdentifier:(NSString *)identifier;
if (self.isMask) {
CGContextSetFillColorWithColor(context, self.targetColor.CGColor);
CGContextSetBlendMode(context, kCGBlendModeSourceAtop);
CGContextFillRect(context, targetRect);
CGContextFillRect(context, CGRectMake(0, 0, targetSize.width, targetSize.height));
}

image = UIGraphicsGetImageFromCurrentImageContext();
Expand Down

0 comments on commit 39bf43c

Please sign in to comment.