diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-03-29 01:50:47 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-03-29 01:50:47 +0000 |
| commit | 4b451d014b0e8dbbe71c61eee19445b567a2e581 (patch) | |
| tree | 02f92fe3af2c922936134d9df654726a6f5e8bca /macosx/Pcsxr-QL | |
| parent | dca90ae6a6e6472c0fd597598651e10c4414be34 (diff) | |
| download | pcsxr-4b451d014b0e8dbbe71c61eee19445b567a2e581.tar.gz | |
OS X:
More work on the QL importer.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89711 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/Pcsxr-QL')
| -rw-r--r-- | macosx/Pcsxr-QL/GeneratePreviewForURL.m | 11 | ||||
| -rw-r--r-- | macosx/Pcsxr-QL/nopic.h | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/macosx/Pcsxr-QL/GeneratePreviewForURL.m b/macosx/Pcsxr-QL/GeneratePreviewForURL.m index 106f1bfb..20cee6ba 100644 --- a/macosx/Pcsxr-QL/GeneratePreviewForURL.m +++ b/macosx/Pcsxr-QL/GeneratePreviewForURL.m @@ -28,7 +28,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, unsigned char *pMem = (unsigned char *) malloc(128*96*3); if (pMem == NULL) return mFulErr; - + f = gzopen(state_filename, "rb"); if (f != NULL) { gzseek(f, 32, SEEK_SET); // skip header @@ -36,17 +36,18 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, gzseek(f, sizeof(uint8_t), SEEK_CUR); gzread(f, pMem, 128*96*3); gzclose(f); - + } else { memcpy(pMem, NoPic_Image.pixel_data, 128*96*3); } - NSBitmapImageRep *imRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char**)&NoPic_Image.pixel_data pixelsWide:NoPic_Image.width pixelsHigh:NoPic_Image.height bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:0 bytesPerRow:NoPic_Image.width * NoPic_Image.bytes_per_pixel bitsPerPixel:24]; + + NSBitmapImageRep *imRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&pMem pixelsWide:NoPic_Image.width pixelsHigh:NoPic_Image.height bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:0 bytesPerRow:NoPic_Image.width * NoPic_Image.bytes_per_pixel bitsPerPixel:24]; if (imRep) { data = [imRep TIFFRepresentation]; QLPreviewRequestSetDataRepresentation(preview, (__bridge CFDataRef)(data), kUTTypeImage, NULL); } - - return noErr; + free(pMem); } + return noErr; } void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview) diff --git a/macosx/Pcsxr-QL/nopic.h b/macosx/Pcsxr-QL/nopic.h index 311e1931..c1dc1609 100644 --- a/macosx/Pcsxr-QL/nopic.h +++ b/macosx/Pcsxr-QL/nopic.h @@ -246,7 +246,7 @@ static void PaintPicDot(unsigned char * p,unsigned char c) ///////////////////////////////////////////////////////////////////// // generic number/border painter -static void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot) +static inline void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot) { unsigned char *pf; int x,y; @@ -293,7 +293,7 @@ static void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot) /* GIMP RGB C-Source image dump (NoPic.h) */ -static struct { +static const struct { unsigned int width; unsigned int height; unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ |
