diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-05-26 22:31:45 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-05-26 22:31:45 +0000 |
| commit | 35d8295de2749fca7a4416bd9e34b3e3598110bf (patch) | |
| tree | 00153df10dbe97bf9328293ab16b76b279430a85 | |
| parent | 2695f8dde55ee10f68f6ccc9e09f12e3901833c5 (diff) | |
| download | pcsxr-35d8295de2749fca7a4416bd9e34b3e3598110bf.tar.gz | |
OS X: working on the QuickLook generator.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@90520 e17a0e51-4ae3-4d35-97c3-1a29b211df97
4 files changed, 98 insertions, 13 deletions
diff --git a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m index 30922bac..0b40d9dd 100644 --- a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m +++ b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m @@ -40,9 +40,10 @@ void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbn OSStatus GenerateThumbnailForFreeze(void *thisInterface, QLThumbnailRequestRef thumbnail, NSURL *url, NSDictionary *options, CGSize maxSize) { - NSData *data; gzFile f; - const char* state_filename; + const char* state_filename = NULL; + NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:96 pixelsHigh:128 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0]; + if ([url respondsToSelector:@selector(fileSystemRepresentation)]) { state_filename = [url fileSystemRepresentation]; } else { @@ -52,10 +53,7 @@ OSStatus GenerateThumbnailForFreeze(void *thisInterface, QLThumbnailRequestRef t return fnfErr; } - unsigned char *pMem = (unsigned char *) malloc(128*96*3); - if (pMem == NULL) - return mFulErr; - + unsigned char pMem[128*96*3] = {0}; f = gzopen(state_filename, "rb"); if (f != NULL) { gzseek(f, 32, SEEK_SET); // skip header @@ -67,12 +65,25 @@ OSStatus GenerateThumbnailForFreeze(void *thisInterface, QLThumbnailRequestRef t memcpy(pMem, NoPic_Image.pixel_data, 128*96*3); } - 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]; + @autoreleasepool { + unsigned char *ppMem = pMem; + int x, y; + for (y = 0; y < 96; y++) { + for (x = 0; x < 128; x++) { + [imageRep setColor:[NSColor colorWithCalibratedRed:*(ppMem+2)/255.0 green:*(ppMem+1)/255.0 blue:*(ppMem+0)/255.0 alpha:1.0] atX:x y:y]; + ppMem+=3; + } + } + } + + NSImage *theImage = [[NSImage alloc] init]; + [theImage addRepresentation:imageRep]; + [theImage setSize:NSMakeSize(NoPic_Image.width, NoPic_Image.height)]; + + if (theImage) { + NSData *data = [theImage TIFFRepresentation]; QLThumbnailRequestSetImageWithData(thumbnail, (__bridge CFDataRef)(data), NULL); } - free(pMem); return noErr; } diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj index 5f81137f..8034e805 100644 --- a/macosx/Pcsxr.xcodeproj/project.pbxproj +++ b/macosx/Pcsxr.xcodeproj/project.pbxproj @@ -2907,7 +2907,6 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = s; @@ -2928,7 +2927,6 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = s; diff --git a/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme index 0f4567f7..3cfcd2c7 100644 --- a/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme +++ b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme @@ -46,7 +46,7 @@ useCustomWorkingDirectory = "NO" buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" + debugDocumentVersioning = "NO" allowLocationSimulation = "YES"> <BuildableProductRunnable> <BuildableReference diff --git a/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/Pcsxr-QL.xcscheme b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/Pcsxr-QL.xcscheme new file mode 100644 index 00000000..e9759098 --- /dev/null +++ b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/Pcsxr-QL.xcscheme @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0510" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "550E343618E6293D00A1AD21" + BuildableName = "Pcsxr-QL.qlgenerator" + BlueprintName = "Pcsxr-QL" + ReferencedContainer = "container:Pcsxr.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" + buildConfiguration = "Debug"> + <Testables> + </Testables> + </TestAction> + <LaunchAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Debug" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "NO" + allowLocationSimulation = "YES"> + <PathRunnable + FilePath = "/System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app/Contents/MacOS/qlmanage"> + </PathRunnable> + <CommandLineArguments> + <CommandLineArgument + argument = "-p /Users/cwbetts/Library/Application\ Support/Pcsxr/Save\ States/SCUS94555-000.pcsxrstate" + isEnabled = "YES"> + </CommandLineArgument> + <CommandLineArgument + argument = "-p /Users/cwbetts/Library/Application\ Support/Pcsxr/Save\ States/JM3_FINAL1V4-SCUS94555.000.pcsxrstate" + isEnabled = "NO"> + </CommandLineArgument> + <CommandLineArgument + argument = "-o /Users/cwbetts/imdemo" + isEnabled = "YES"> + </CommandLineArgument> + </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Release" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> |
