Skip to content
Browse files

cleanup

  • Loading branch information...
1 parent 63459a4 commit 00f360a8eefd2556df705c7ef44c2696ef83885e @mattrajca mattrajca committed
View
17 QLPlugin/Source/GeneratePreviewForURL.m
@@ -10,15 +10,15 @@
void CancelPreviewGeneration (void* thisInterface, QLPreviewRequestRef preview);
/* -----------------------------------------------------------------------------
- Generate a preview for file
-
- This function's job is to create preview for designated file
- ----------------------------------------------------------------------------- */
+ Generate a preview for file
+
+ This function's job is to create preview for designated file
+ ----------------------------------------------------------------------------- */
OSStatus GeneratePreviewForURL (void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
-{
+{
@autoreleasepool {
-
+
PXCanvas *canvas = [NSKeyedUnarchiver unarchiveObjectWithFile:[ (__bridge NSURL *) url path]];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -32,9 +32,8 @@ OSStatus GeneratePreviewForURL (void *thisInterface, QLPreviewRequestRef preview
QLPreviewRequestFlushContext(preview, ctx);
-
- return noErr;
- }
+ return noErr;
+ }
}
void CancelPreviewGeneration (void* thisInterface, QLPreviewRequestRef preview)
View
15 QLPlugin/Source/GenerateThumbnailForURL.m
@@ -10,15 +10,15 @@
void CancelThumbnailGeneration (void* thisInterface, QLThumbnailRequestRef thumbnail);
/* -----------------------------------------------------------------------------
- Generate a thumbnail for file
-
- This function's job is to create thumbnail for designated file as fast as possible
- ----------------------------------------------------------------------------- */
+ Generate a thumbnail for file
+
+ This function's job is to create thumbnail for designated file as fast as possible
+ ----------------------------------------------------------------------------- */
OSStatus GenerateThumbnailForURL (void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize)
{
@autoreleasepool {
-
+
PXCanvas *canvas = [NSKeyedUnarchiver unarchiveObjectWithFile:[ (__bridge NSURL *) url path]];
CGContextRef ctx = QLThumbnailRequestCreateContext(thumbnail, NSSizeToCGSize([canvas size]), 1, NULL);
@@ -28,9 +28,8 @@ OSStatus GenerateThumbnailForURL (void *thisInterface, QLThumbnailRequestRef thu
QLThumbnailRequestFlushContext(thumbnail, ctx);
-
- return noErr;
- }
+ return noErr;
+ }
}
void CancelThumbnailGeneration (void* thisInterface, QLThumbnailRequestRef thumbnail)
View
14 QLPlugin/Source/PXCanvas.m
@@ -18,19 +18,21 @@ - (id)initWithCoder:(NSCoder *)coder
self = [super init];
if (self) {
int version = [coder decodeIntForKey:@"version"];
+
if (version <= 4) {
BOOL isIndexedImage = [coder containsValueForKey:@"palette"];
- PXPalette *palette = NULL;
- if(isIndexedImage) {
- palette = [[PXPalette alloc] initWithCoder:coder];
-
+
+ if (isIndexedImage) {
+ PXPalette *palette = [[PXPalette alloc] initWithCoder:coder];
[coder associateValue:palette withKey:@"palette"];
}
+
layers = [coder decodeObjectForKey:@"layers"];
- if(isIndexedImage) {
+
+ if (isIndexedImage) {
[coder associateValue:nil withKey:@"palette"];
}
- }
+ }
}
return self;
}

0 comments on commit 00f360a

Please sign in to comment.
Something went wrong with that request. Please try again.