comparison mac/dw.m @ 1144:5878dbfafbe2

Need to size the NSImageView to print it apparently on Mac. Also release the NSImageView and NSImage so we don't leak.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 11 Sep 2011 02:45:38 +0000
parents b1b23de965d7
children 9d97610b2140
comparison
equal deleted inserted replaced
1143:b1b23de965d7 1144:5878dbfafbe2
9355 * to go into the image view. 9355 * to go into the image view.
9356 */ 9356 */
9357 image = [[NSImage alloc] initWithSize:[rep size]]; 9357 image = [[NSImage alloc] initWithSize:[rep size]];
9358 [image addRepresentation:rep]; 9358 [image addRepresentation:rep];
9359 [iv setImage:image]; 9359 [iv setImage:image];
9360 [iv setImageScaling:NSScaleProportionally];
9361 [iv setFrameOrigin:NSMakePoint(0,0)];
9362 [iv setFrameSize:size];
9360 9363
9361 /* Create the print operation using the image view and 9364 /* Create the print operation using the image view and
9362 * print info obtained from the panel in the last call. 9365 * print info obtained from the panel in the last call.
9363 */ 9366 */
9364 po = [NSPrintOperation printOperationWithView:iv printInfo:pi]; 9367 po = [NSPrintOperation printOperationWithView:iv printInfo:pi];
9387 dw_draw_rect(0, pixmap, TRUE, 0, 0, (int)size.width, (int)size.height); 9390 dw_draw_rect(0, pixmap, TRUE, 0, 0, (int)size.width, (int)size.height);
9388 } 9391 }
9389 if(p->drawfunc) 9392 if(p->drawfunc)
9390 result = DW_ERROR_NONE; 9393 result = DW_ERROR_NONE;
9391 /* Free memory */ 9394 /* Free memory */
9395 [image release];
9392 dw_pixmap_destroy(pixmap); 9396 dw_pixmap_destroy(pixmap);
9393 free(p); 9397 free(p);
9398 [iv release];
9394 return result; 9399 return result;
9395 } 9400 }
9396 9401
9397 /* 9402 /*
9398 * Cancels the print job, typically called from a draw page callback. 9403 * Cancels the print job, typically called from a draw page callback.