From 527d73847a3cae4128513bbee3b190114b986c0b Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 26 Mar 2020 17:17:49 +0100 Subject: [PATCH] Remove unused _read_ppm_image from macosx.m. It's not used anywhere since d8a08bc --- src/_macosx.m | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/src/_macosx.m b/src/_macosx.m index 716cc44be539..604bbbb27de5 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -458,46 +458,6 @@ static CGFloat _get_device_scale(CGContextRef cr) Py_RETURN_NONE; } -static NSImage* _read_ppm_image(PyObject* obj) -{ - int width; - int height; - const char* data; - int n; - int i; - NSBitmapImageRep* bitmap; - unsigned char* bitmapdata; - - if (!obj) return NULL; - if (!PyTuple_Check(obj)) return NULL; - if (!PyArg_ParseTuple(obj, "iit#", &width, &height, &data, &n)) return NULL; - if (width*height*3 != n) return NULL; /* RGB image uses 3 colors / pixel */ - - bitmap = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes: NULL - pixelsWide: width - pixelsHigh: height - bitsPerSample: 8 - samplesPerPixel: 3 - hasAlpha: NO - isPlanar: NO - colorSpaceName: NSDeviceRGBColorSpace - bitmapFormat: 0 - bytesPerRow: width*3 - bitsPerPixel: 24]; - if (!bitmap) return NULL; - bitmapdata = [bitmap bitmapData]; - for (i = 0; i < n; i++) bitmapdata[i] = data[i]; - - NSSize size = NSMakeSize(width, height); - NSImage* image = [[NSImage alloc] initWithSize: size]; - if (image) [image addRepresentation: bitmap]; - - [bitmap release]; - - return image; -} - static PyObject* FigureCanvas_start_event_loop(FigureCanvas* self, PyObject* args, PyObject* keywords) {