Revision: 5682
http://skim-app.svn.sourceforge.net/skim-app/?rev=5682&view=rev
Author: hofman
Date: 2009-09-05 11:48:03 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
workaround for 10.6 64-bit bug in PDFKit
Modified Paths:
--------------
trunk/PDFBorder_SKExtensions.m
Modified: trunk/PDFBorder_SKExtensions.m
===================================================================
--- trunk/PDFBorder_SKExtensions.m 2009-09-05 01:02:56 UTC (rev 5681)
+++ trunk/PDFBorder_SKExtensions.m 2009-09-05 11:48:03 UTC (rev 5682)
@@ -37,7 +37,21 @@
*/
#import "PDFBorder_SKExtensions.h"
+#import "SKRuntime.h"
+#import <objc/objc-runtime.h>
+/*
+...@interface PDFBorderPrivateVars : NSObject
+{
+ NSUInteger style;
+ CGFloat hCornerRadius;
+ CGFloat vCornerRadius;
+ CGFloat lineWidth;
+ NSUInteger dashCount;
+ CGFloat *dashPattern;
+}
+...@end
+*/
@implementation PDFBorder (SKExtensions)
@@ -51,4 +65,28 @@
return copy;
}
+#if __LP64__
+
+static id (*original_dashPattern)(id, SEL) = NULL;
+
+- (NSArray *)replacement_dashPattern {
+ id vars = [self valueForKey:@"pdfPriv"];
+ NSMutableArray *pattern = [NSMutableArray array];
+ NSUInteger i, count;
+ object_getInstanceVariable(vars, "dashCount", (void *)&count);
+ CGFloat *dashPattern;
+ object_getInstanceVariable(vars, "dashPattern", (void *)&dashPattern);
+ for (i = 0; i < count; i++)
+ [pattern addObject:[NSNumber numberWithDouble:dashPattern[i]]];
+ return pattern;
+}
+
++ (void)load {
+ // on 10.6 the implementation of -dashPattern is badly broken, probably
due to the wrong type for _pdfPriv.dashCount
+ if (floor(NSAppKitVersionNumber) > 949)
+ original_dashPattern = (id (*)(id,
SEL))SKReplaceInstanceMethodImplementationFromSelector(self,
@selector(dashPattern), @selector(replacement_dashPattern));
+}
+
+#endif
+
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit