changeset 1176:408ea33b19cf

Ok fixed a problem with the last commit using the wrong representation on Mac. This shows that the problem was in fact the flipped image but the image view still seems to be printing oddly... but at least the important stuff is there now.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Sep 2011 19:48:23 +0000
parents eb4589ddff3e
children c38ec904b6d3
files mac/dw.m
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Mon Sep 19 19:37:35 2011 +0000
+++ b/mac/dw.m	Mon Sep 19 19:48:23 2011 +0000
@@ -9406,6 +9406,12 @@
     /* Figure out the printer/paper size */
     pi = p->pi;
     size = [pi paperSize];
+    /* Okay the size reported is really small... and everything
+     * in Cocoa is scaled so ... multiply by 2 to get a better
+     * resolution but maintain the right aspect ratio.
+     */
+    size.width *= 2;
+    size.height *= 2;
     /* Create an image view to print and a pixmap to draw into */
     iv = [[NSImageView alloc] init];
     pixmap = dw_pixmap_new(iv, (int)size.width, (int)size.height, 8);
@@ -9419,7 +9425,7 @@
     image = [[NSImage alloc] initWithSize:[rep size]];
     flipped = [[NSImage alloc] initWithSize:[rep size]];
     [image addRepresentation:rep];
-    [flipped addRepresentation:pixmap->image];
+    [flipped addRepresentation:rep2];
     [iv setImage:flipped];
     [iv setImageScaling:NSScaleProportionally];
     [iv setFrameOrigin:NSMakePoint(0,0)];
@@ -9449,9 +9455,11 @@
         p->drawfunc(print, pixmap, x, p->drawdata);
         /* Internal representation is flipped... so flip again so we can print */
         _flip_image(image, rep2, size);
+#ifdef DEBUG_PRINT
         /* Save it to file to see what we have */
         NSData *data = [rep2 representationUsingType: NSPNGFileType properties: nil];
         [data writeToFile: @"print.png" atomically: NO];
+#endif
         /* Print the image view */
         [po runOperation];
         /* Fill the pixmap with white in case we are printing more pages */