Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c073bba

Browse files
authored
Merge pull request #16920 from anntzer/read_ppm
Remove unused _read_ppm_image from macosx.m.
2 parents 536fffe + 527d738 commit c073bba

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

src/_macosx.m

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -458,46 +458,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
458458
Py_RETURN_NONE;
459459
}
460460

461-
static NSImage* _read_ppm_image(PyObject* obj)
462-
{
463-
int width;
464-
int height;
465-
const char* data;
466-
int n;
467-
int i;
468-
NSBitmapImageRep* bitmap;
469-
unsigned char* bitmapdata;
470-
471-
if (!obj) return NULL;
472-
if (!PyTuple_Check(obj)) return NULL;
473-
if (!PyArg_ParseTuple(obj, "iit#", &width, &height, &data, &n)) return NULL;
474-
if (width*height*3 != n) return NULL; /* RGB image uses 3 colors / pixel */
475-
476-
bitmap = [[NSBitmapImageRep alloc]
477-
initWithBitmapDataPlanes: NULL
478-
pixelsWide: width
479-
pixelsHigh: height
480-
bitsPerSample: 8
481-
samplesPerPixel: 3
482-
hasAlpha: NO
483-
isPlanar: NO
484-
colorSpaceName: NSDeviceRGBColorSpace
485-
bitmapFormat: 0
486-
bytesPerRow: width*3
487-
bitsPerPixel: 24];
488-
if (!bitmap) return NULL;
489-
bitmapdata = [bitmap bitmapData];
490-
for (i = 0; i < n; i++) bitmapdata[i] = data[i];
491-
492-
NSSize size = NSMakeSize(width, height);
493-
NSImage* image = [[NSImage alloc] initWithSize: size];
494-
if (image) [image addRepresentation: bitmap];
495-
496-
[bitmap release];
497-
498-
return image;
499-
}
500-
501461
static PyObject*
502462
FigureCanvas_start_event_loop(FigureCanvas* self, PyObject* args, PyObject* keywords)
503463
{

0 commit comments

Comments
 (0)