OS X: working on the QuickLook generator.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@90520 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
parent
2695f8dde5
commit
35d8295de2
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugDocumentVersioning = "NO"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue
Block a user