From fbd01308b987713ed7487014f15abb99dd5ae2d2 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 18 Jan 2007 15:25:09 +0000 Subject: Fixed Quartz image drawing and screen reading git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5614 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_read_image_mac.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/fl_read_image_mac.cxx') diff --git a/src/fl_read_image_mac.cxx b/src/fl_read_image_mac.cxx index 3cdbd48c4..6a1ba7a67 100644 --- a/src/fl_read_image_mac.cxx +++ b/src/fl_read_image_mac.cxx @@ -43,7 +43,7 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate int alpha) { // I - Alpha value for image (0 for none) Rect src, // Source rectangle dst; // Destination rectangle - Fl_Offscreen osbuffer; // Temporary off-screen buffer for copy + GWorldPtr osbuffer; // Temporary off-screen buffer for copy GrafPtr srcPort; // Source port RGBColor rgb; // RGB colors for copy mask... PixMapHandle pm; // Pixmap handle for off-screen buffer @@ -54,12 +54,6 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate int d; // Depth of image int rowBytes; // Number of bytes per row... - - // Get an off-screen buffer for copying the image... - osbuffer = fl_create_offscreen(w,h); - - if (!osbuffer) return 0; - // Set the source and destination rectangles... src.top = y; src.left = x; @@ -71,6 +65,14 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate dst.bottom = h; dst.right = w; + // Get an off-screen buffer for copying the image... + QDErr err = NewGWorld(&osbuffer, 0, &dst, 0L, 0L, 0); + if (!osbuffer) return 0; + if (err!=noErr) { + DisposeGWorld(osbuffer); + return 0; + } + // Get the source port... GetPort(&srcPort); @@ -121,10 +123,9 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate pdst[2] = psrc[2]; } #endif // __i386__ - // Unlock and delete the off-screen buffer, then return... UnlockPixels(pm); - fl_delete_offscreen(osbuffer); + DisposeGWorld(osbuffer); SetPort(srcPort); return p; -- cgit v1.2.3