From 39bf43cb9f8317f17f7738bd55c5cfc65548328a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 11 Oct 2012 00:41:06 +0200 Subject: [PATCH] Small cleanups. --- Example/AppDelegate.m | 1 + Source/FTPDFIconRenderer.m | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m index 4f22f9a..745fb30 100644 --- a/Example/AppDelegate.m +++ b/Example/AppDelegate.m @@ -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]; diff --git a/Source/FTPDFIconRenderer.m b/Source/FTPDFIconRenderer.m index 76a2af2..839421b 100644 --- a/Source/FTPDFIconRenderer.m +++ b/Source/FTPDFIconRenderer.m @@ -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(); @@ -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); @@ -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();