From 6d34c647ca0e83edd89fc7f1c0a98d485d569002 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 29 Feb 2016 17:35:49 +0000 Subject: Accept fl_draw_image(buf, X,Y,W,H,D,L) with negative D and/or L arguments on the Mac OS platform. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11251 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- .../Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 77 ++++++---------------- 1 file changed, 21 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index 3574adce5..daf26951c 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -53,91 +53,56 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, int delta, int linedelta, int mono, Fl_Draw_Image_Cb cb, void* userdata, CGContextRef gc) { - if (!linedelta) linedelta = W*delta; + if (!linedelta) linedelta = W*abs(delta); const void *array = buf; uchar *tmpBuf = 0; if (cb || Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { - tmpBuf = new uchar[ H*W*delta ]; + tmpBuf = new uchar[ H*W*abs(delta) ]; if (cb) { for (int i=0; idraw_CGImage(img, X,Y,W,H, 0,0,W,H); - // release all allocated resources - CGImageRelease(img); - } CGColorSpaceRelease(lut); CGDataProviderRelease(src); - 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(gc, false); - if ( cb ) - { - uchar *tmpBuf = new uchar[ W*4 ]; - for ( int i=0; idraw_CGImage(img, 0,0,W,H, 0,0,W,H); + CGImageRelease(img); } - CGContextSetShouldAntialias(gc, true); } void Fl_Quartz_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){ -- cgit v1.2.3