diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2004-09-10 00:07:52 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2004-09-10 00:07:52 +0000 |
| commit | 0f61ac6bf0d98ffa58bd95770f8f2b478dbef155 (patch) | |
| tree | a472a9f4301bd0c976d8c06e65a2fb6d699de535 /src | |
| parent | f16922a9fecdd73e6d12dd6150ba295329b84a6c (diff) | |
Quartz:
- would not render images that weren't compatible to system formats
(mandelbrot). Mandelbrot is still twitchy though.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3814 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_draw_image_mac.cxx | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx index 12491654c..8034c8d7e 100644 --- a/src/fl_draw_image_mac.cxx +++ b/src/fl_draw_image_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_draw_image_mac.cxx,v 1.1.2.10 2004/09/09 23:43:40 matthiaswm Exp $" +// "$Id: fl_draw_image_mac.cxx,v 1.1.2.11 2004/09/10 00:07:52 matthiaswm Exp $" // // MacOS image drawing code for the Fast Light Tool Kit (FLTK). // @@ -165,37 +165,37 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, } } #elif defined(__APPLE_QUARTZ__) - if (delta>=1||delta<=4) { - void *array = buf; - uchar *tmpBuf; - if (cb) { - tmpBuf = new uchar[ H*W*delta ]; - for (int i=0; i<H; i++) { - cb(userdata, 0, i, W, tmpBuf+i*W*delta); - } - array = (void*)tmpBuf; - linedelta = W; + void *array = buf; + uchar *tmpBuf; + if (cb) { + tmpBuf = new uchar[ H*W*delta ]; + for (int i=0; i<H; i++) { + cb(userdata, 0, i, W, tmpBuf+i*W*delta); } - // create an image context - CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); - CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H*delta, 0L); - CGImageRef img = CGImageCreate( W, H, 8, 8*delta, linedelta*delta, - lut, kCGImageAlphaNone, - src, 0L, false, kCGRenderingIntentDefault); - // draw the image into the destination context + array = (void*)tmpBuf; + linedelta = W; + } + // create an image context + CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); + CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H*delta, 0L); + CGImageRef img = CGImageCreate( W, H, 8, 8*delta, linedelta*delta, + lut, delta&1?kCGImageAlphaNone:kCGImageAlphaNoneSkipLast, + src, 0L, false, kCGRenderingIntentDefault); + // draw the image into the destination context + if (img) { CGRect rect = { X, Y, W, H }; Fl_X::q_begin_image(rect, 0, 0, W, H); CGContextDrawImage(fl_gc, rect, img); Fl_X::q_end_image(); // release all allocated resources CGImageRelease(img); - CGColorSpaceRelease(lut); - CGDataProviderRelease(src); - if (cb) { - delete[] tmpBuf; - } - return; } + CGColorSpaceRelease(lut); + CGDataProviderRelease(src); + if (cb) { + delete[] tmpBuf; + } + if (img) return; // else fall through to slow mode // following the very save (and very slow) way to write the image into the give port CGContextSetShouldAntialias(fl_gc, false); if ( cb ) @@ -264,5 +264,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { } // -// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.10 2004/09/09 23:43:40 matthiaswm Exp $". +// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.11 2004/09/10 00:07:52 matthiaswm Exp $". // |
