diff options
Diffstat (limited to 'ios')
-rw-r--r-- | ios/main.m | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -15,6 +15,7 @@ static dispatch_queue_t queue; static fz_glyph_cache *glyphcache = NULL; +static float screenScale = 1; @interface MuLibraryController : UITableViewController { @@ -160,7 +161,10 @@ static UIImage *newImageWithPixmap(fz_pixmap *pix) CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrderDefault, cgdata, NULL, NO, kCGRenderingIntentDefault); - UIImage *image = [[UIImage alloc] initWithCGImage: cgimage]; + UIImage *image = [[UIImage alloc] + initWithCGImage: cgimage + scale: screenScale + orientation: UIImageOrientationUp]; CGDataProviderRelease(cgdata); CGImageRelease(cgimage); return image; @@ -194,6 +198,9 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen) return nil; } + screen.width *= screenScale; + screen.height *= screenScale; + mediabox = fz_transform_rect(fz_rotate(page->rotate), page->mediabox); pagesize = CGSizeMake(mediabox.x1 - mediabox.x0, mediabox.y1 - mediabox.y0); scale = fitPageToScreen(pagesize, screen); @@ -236,6 +243,13 @@ static UIImage *renderTile(pdf_xref *xref, int number, CGSize screen, CGRect til return nil; } + screen.width *= screenScale; + screen.height *= screenScale; + tile.origin.x *= screenScale; + tile.origin.y *= screenScale; + tile.size.width *= screenScale; + tile.size.height *= screenScale; + mediabox = fz_transform_rect(fz_rotate(page->rotate), page->mediabox); pagesize = CGSizeMake(mediabox.x1 - mediabox.x0, mediabox.y1 - mediabox.y0); scale = fitPageToScreen(pagesize, screen); @@ -1085,6 +1099,8 @@ static UIImage *renderTile(pdf_xref *xref, int number, CGSize screen, CGRect til glyphcache = fz_new_glyph_cache(); + screenScale = [[UIScreen mainScreen] scale]; + library = [[MuLibraryController alloc] initWithStyle: UITableViewStylePlain]; navigator = [[UINavigationController alloc] initWithRootViewController: library]; |