Commit Diff


commit - 68bb0cb407bd94be22e849392bb121019950cfac
commit + edf406e2b69b6fb0360ec847f552a950577205bf
blob - faf4005511f8098b5ebd951912af067b1aed3892
blob + e860e423f77917c12ad3834b63486eb195aea14d
--- ComicSaver/ComicSaverView.m
+++ ComicSaver/ComicSaverView.m
@@ -22,7 +22,10 @@
 
 - (void)startAnimation
 {
-    document = MyGetPDFDocumentRef ("/Users/leo/Documents/Shared/Comics/Letter 44/letter44_vol1_1412097863.pdf");
+    NSString *localPath = @"/Documents/Shared/Comics/Letter 44/letter44_vol1_1412097863.pdf";
+    NSString *docPath = [NSString stringWithFormat:@"%@%@", NSHomeDirectory(), localPath];
+    document = MyGetPDFDocumentRef ([docPath UTF8String]);
+    
     long numberOfPages = CGPDFDocumentGetNumberOfPages (document);
     page = CGPDFDocumentGetPage (document, (random()%numberOfPages)+1);
     [super startAnimation];
@@ -43,12 +46,12 @@
     
     CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
     CGContextFillRect(context, clip);
-    CGContextTranslateCTM(context, 0.0, -(clip.size.height + cropBox.size.height));
+    CGContextTranslateCTM(context, 0.0, 0.0);
     CGContextScaleCTM(context, 1.0, 1.0);
     
     CGFloat xScale = clip.size.width / cropBox.size.width;
     CGFloat yScale = clip.size.height / cropBox.size.height;
-    CGFloat scaleToApply = xScale < yScale ? yScale : xScale;
+    CGFloat scaleToApply = xScale < yScale ? xScale : yScale;
     CGContextConcatCTM(context, CGAffineTransformMakeScale(scaleToApply, scaleToApply));
     //    CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, clip, 0, true));
     CGContextDrawPDFPage (context, page);