From: Jay Freeman (saurik) Date: Thu, 9 Jan 2014 05:52:53 +0000 (-0800) Subject: Bring ARM64 float->CGFloat up towards ARM support. X-Git-Tag: v0.9.3912~19 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/0fa37711e712065c6d15a8ea18f4780002035095 Bring ARM64 float->CGFloat up towards ARM support. --- diff --git a/Library.mm b/Library.mm index 78f9125..b2ee645 100644 --- a/Library.mm +++ b/Library.mm @@ -604,7 +604,7 @@ MSHook(UIImage *, SBApplicationIcon$generateIconImage$, SBApplicationIcon *self, return [UIImage imageWithContentsOfFile:path72]; if (NSString *path = $pathForIcon$([self application])) if (UIImage *image = [UIImage imageWithContentsOfFile:path]) { - float width; + CGFloat width; if ([$SBIcon respondsToSelector:@selector(defaultIconImageSize)]) width = [$SBIcon defaultIconImageSize].width; else @@ -689,13 +689,13 @@ MSInstanceMessageHook2(NSString *, NSBundle, pathForResource,ofType, NSString *, static void $drawLabel$(NSString *label, CGRect rect, NSString *style, NSString *custom) { bool ellipsis(false); - float max = rect.size.width - 11, width; + CGFloat max = rect.size.width - 11, width; width: width = [(ellipsis ? [label stringByAppendingString:@"..."] : label) sizeWithStyle:style forWidth:320].width; if (width > max) { size_t length([label length]); - float spacing((width - max) / (length - 1)); + CGFloat spacing((width - max) / (length - 1)); if (spacing > 1.25) { ellipsis = true; @@ -976,7 +976,7 @@ MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *s if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"]) daystyle = [daystyle stringByAppendingString:style]; - float width([self bounds].size.width); + CGFloat width([self bounds].size.width); float leeway(10); CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)]; CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)]; @@ -2105,7 +2105,7 @@ static void NSString$drawInRect$withStyle$(NSString *self, SEL _cmd, CGRect rect return [[WBMarkup sharedMarkup] drawString:self inRect:rect withStyle:style]; } -static CGSize NSString$sizeWithStyle$forWidth$(NSString *self, SEL _cmd, NSString *style, float width) { +static CGSize NSString$sizeWithStyle$forWidth$(NSString *self, SEL _cmd, NSString *style, CGFloat width) { if (style == nil || [style length] == 0) style = @"font-family: Helvetica; font-size: 12px"; CGSize size([[WBMarkup sharedMarkup] sizeOfString:self withStyle:style forWidth:width]); @@ -2346,9 +2346,15 @@ MSInitialize { // }}} // UIKit {{{ if (MSImageRef image = MSGetImageByName("/System/Library/Frameworks/UIKit.framework/UIKit")) { +#ifdef __LP64__ + class_addMethod($NSString, @selector(drawAtPoint:withStyle:), (IMP) &NSString$drawAtPoint$withStyle$, "v40@0:8{CGPoint=dd}16@32"); + class_addMethod($NSString, @selector(drawInRect:withStyle:), (IMP) &NSString$drawInRect$withStyle$, "v56@0:8{CGRect={CGSize=dd}{CGSize=dd}}16@48"); + class_addMethod($NSString, @selector(sizeWithStyle:forWidth:), (IMP) &NSString$sizeWithStyle$forWidth$, "{CGSize=dd}32@0:8@16d24"); +#else class_addMethod($NSString, @selector(drawAtPoint:withStyle:), (IMP) &NSString$drawAtPoint$withStyle$, "v20@0:4{CGPoint=ff}8@16"); class_addMethod($NSString, @selector(drawInRect:withStyle:), (IMP) &NSString$drawInRect$withStyle$, "v28@0:4{CGRect={CGSize=ff}{CGSize=ff}}8@24"); class_addMethod($NSString, @selector(sizeWithStyle:forWidth:), (IMP) &NSString$sizeWithStyle$forWidth$, "{CGSize=ff}16@0:4@8f12"); +#endif WBHookSymbol(image, _UIKitBundle); WBHookSymbol(image, _UIPackedImageTableGetIdentifierForName); diff --git a/WBMarkup.h b/WBMarkup.h index 24645e0..a60e8fb 100644 --- a/WBMarkup.h +++ b/WBMarkup.h @@ -28,11 +28,11 @@ - (void) setStringDrawingOrigin:(CGPoint)origin; - (void) clearStringDrawingOrigin; -- (CGSize) sizeOfMarkup:(NSString *)markup forWidth:(float)width; -- (CGSize) sizeOfString:(NSString *)string withStyle:(NSString *)style forWidth:(float)width; +- (CGSize) sizeOfMarkup:(NSString *)markup forWidth:(CGFloat)width; +- (CGSize) sizeOfString:(NSString *)string withStyle:(NSString *)style forWidth:(CGFloat)width; - (NSString *) _styleFormatString:(NSString *)style; -- (void) _setupWithStyle:(NSString *)style width:(float)width height:(float)height; +- (void) _setupWithStyle:(NSString *)style width:(CGFloat)width height:(CGFloat)height; - (BOOL) _webPrepareContextForTextDrawing:(BOOL)drawing; - (void) drawMarkup:(NSString *)markup atPoint:(CGPoint)point; diff --git a/WBMarkup.mm b/WBMarkup.mm index f371367..9918a28 100644 --- a/WBMarkup.mm +++ b/WBMarkup.mm @@ -151,7 +151,7 @@ static WBMarkup *SharedMarkup_; origin_ = CGPointZero; } -- (CGSize) sizeOfMarkup:(NSString *)markup forWidth:(float)width { +- (CGSize) sizeOfMarkup:(NSString *)markup forWidth:(CGFloat)width { WebThreadLock(); if (![self _webPrepareContextForTextDrawing:NO]) @@ -168,7 +168,7 @@ static WBMarkup *SharedMarkup_; return [[view_ mainFrame] renderedSizeOfNode:text_ constrainedToWidth:width]; } -- (CGSize) sizeOfString:(NSString *)string withStyle:(NSString *)style forWidth:(float)width { +- (CGSize) sizeOfString:(NSString *)string withStyle:(NSString *)style forWidth:(CGFloat)width { WebThreadLock(); if (![self _webPrepareContextForTextDrawing:NO]) @@ -190,7 +190,7 @@ static WBMarkup *SharedMarkup_; return style; } -- (void) _setupWithStyle:(NSString *)style width:(float)width height:(float)height { +- (void) _setupWithStyle:(NSString *)style width:(CGFloat)width height:(CGFloat)height { WebThreadLock(); if (style != nil && [style length] != 0)