Revision: 2737
http://skim-app.svn.sourceforge.net/skim-app/?rev=2737&view=rev
Author: hofman
Date: 2007-08-27 13:17:28 -0700 (Mon, 27 Aug 2007)
Log Message:
-----------
Use float math functions for float arguments.
Modified Paths:
--------------
trunk/NSGeometry_SKExtensions.h
trunk/NSGeometry_SKExtensions.m
trunk/SKColorSwatch.m
trunk/SKLineInspector.m
trunk/SKLineWell.m
trunk/SKMainWindowController.m
trunk/SKNoteOutlineView.m
trunk/SKPDFAnnotationNote.m
trunk/SKPDFHoverWindow.m
trunk/SKPDFSynchronizer.m
trunk/SKPDFView.m
trunk/SKSplitView.m
trunk/SKStatusBar.m
trunk/SKThumbnailTableView.m
Modified: trunk/NSGeometry_SKExtensions.h
===================================================================
--- trunk/NSGeometry_SKExtensions.h 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/NSGeometry_SKExtensions.h 2007-08-27 20:17:28 UTC (rev 2737)
@@ -77,26 +77,26 @@
static inline NSRect SKRectFromPoints(NSPoint aPoint, NSPoint bPoint) {
NSRect rect;
- rect.origin.x = fmin(aPoint.x, bPoint.x);
- rect.origin.y = fmin(aPoint.y, bPoint.y);
- rect.size.width = fmax(aPoint.x, bPoint.x) - NSMinX(rect);
- rect.size.height = fmax(aPoint.y, bPoint.y) - NSMinY(rect);
+ rect.origin.x = fminf(aPoint.x, bPoint.x);
+ rect.origin.y = fminf(aPoint.y, bPoint.y);
+ rect.size.width = fmaxf(aPoint.x, bPoint.x) - NSMinX(rect);
+ rect.size.height = fmaxf(aPoint.y, bPoint.y) - NSMinY(rect);
return rect;
}
static inline NSRect SKIntegralRectFromPoints(NSPoint aPoint, NSPoint bPoint) {
NSRect rect;
- rect.origin.x = floorf(fmin(aPoint.x, bPoint.x));
- rect.origin.y = floorf(fmin(aPoint.y, bPoint.y));
- rect.size.width = ceilf(fmax(aPoint.x, bPoint.x) - NSMinX(rect));
- rect.size.height = ceilf(fmax(aPoint.y, bPoint.y) - NSMinY(rect));
+ rect.origin.x = floorf(fminf(aPoint.x, bPoint.x));
+ rect.origin.y = floorf(fminf(aPoint.y, bPoint.y));
+ rect.size.width = ceilf(fmaxf(aPoint.x, bPoint.x) - NSMinX(rect));
+ rect.size.height = ceilf(fmaxf(aPoint.y, bPoint.y) - NSMinY(rect));
return rect;
}
static inline NSRect SKRectFromCenterAndPoint(NSPoint center, NSPoint point) {
NSRect rect;
- rect.size.width = 2.0 * fabs(center.x - point.x);
- rect.size.height = 2.0 * fabs(center.y - point.y);
+ rect.size.width = 2.0 * fabsf(center.x - point.x);
+ rect.size.height = 2.0 * fabsf(center.y - point.y);
rect.origin.x = center.x - 0.5 * NSWidth(rect);
rect.origin.y = center.y - 0.5 * NSHeight(rect);
return rect;
Modified: trunk/NSGeometry_SKExtensions.m
===================================================================
--- trunk/NSGeometry_SKExtensions.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/NSGeometry_SKExtensions.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -72,9 +72,9 @@
}
NSRect SKIntersectionRect(NSRect rect, NSRect boundary) {
- float minX = fmin(fmax(NSMinX(rect), NSMinX(boundary)), NSMaxX(boundary));
- float maxX = fmax(fmin(NSMaxX(rect), NSMaxX(boundary)), NSMinX(boundary));
- float minY = fmin(fmax(NSMinY(rect), NSMinY(boundary)), NSMaxY(boundary));
- float maxY = fmax(fmin(NSMaxY(rect), NSMaxY(boundary)), NSMinY(boundary));
+ float minX = fminf(fmaxf(NSMinX(rect), NSMinX(boundary)),
NSMaxX(boundary));
+ float maxX = fmaxf(fminf(NSMaxX(rect), NSMaxX(boundary)),
NSMinX(boundary));
+ float minY = fminf(fmaxf(NSMinY(rect), NSMinY(boundary)),
NSMaxY(boundary));
+ float maxY = fmaxf(fminf(NSMaxY(rect), NSMaxY(boundary)),
NSMinY(boundary));
return NSMakeRect(minX, minY, maxX - minX, maxY - minY);
}
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKColorSwatch.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -117,7 +117,7 @@
- (void)sizeToFit {
NSRect frame = [self frame];
int count = [colors count];
- frame.size.width = fmin(NSWidth(frame), count * (NSHeight(frame) - 3.0) +
3.0);
+ frame.size.width = fminf(NSWidth(frame), count * (NSHeight(frame) - 3.0) +
3.0);
[self setFrame:frame];
}
@@ -125,7 +125,7 @@
NSRect bounds = [self bounds];
int count = [colors count];
- bounds.size.width = fmin(NSWidth(bounds), count * (NSHeight(bounds) - 3.0)
+ 3.0);
+ bounds.size.width = fminf(NSWidth(bounds), count * (NSHeight(bounds) -
3.0) + 3.0);
NSRectEdge sides[4] = {NSMaxYEdge, NSMaxXEdge, NSMinXEdge, NSMinYEdge};
float grays[4] = {0.5, 0.75, 0.75, 0.75};
Modified: trunk/SKLineInspector.m
===================================================================
--- trunk/SKLineInspector.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKLineInspector.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -420,7 +420,7 @@
}
- (void)setLineWidth:(float)width {
- if (fabs(lineWidth - width) > 0.00001) {
+ if (fabsf(lineWidth - width) > 0.00001) {
lineWidth = width;
[self sendActionToTarget:@selector(changeLineWidth:)];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKLineInspectorLineWidthDidChangeNotification object:self];
Modified: trunk/SKLineWell.m
===================================================================
--- trunk/SKLineWell.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKLineWell.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -558,7 +558,7 @@
}
- (void)setLineWidth:(float)width {
- if (fabs(lineWidth - width) > 0.00001) {
+ if (fabsf(lineWidth - width) > 0.00001) {
lineWidth = width;
[self updateValue:[NSNumber numberWithFloat:lineWidth]
forKey:@"lineWidth"];
}
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKMainWindowController.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -809,7 +809,7 @@
NSString *label = [[document pageAtIndex:i] label];
[pageLabels addObject:label ? label : @""];
[cell setStringValue:label];
- labelWidth = fmax(labelWidth, [cell cellSize].width);
+ labelWidth = fmaxf(labelWidth, [cell cellSize].width);
}
[self didChangeValueForKey:@"pageLabels"];
@@ -1029,7 +1029,7 @@
[thumbnail setImage:image];
newSize = [image size];
- if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height -
oldSize.height) > 1.0) {
+ if (fabsf(newSize.width - oldSize.width) > 1.0 || fabsf(newSize.height
- oldSize.height) > 1.0) {
[thumbnailTableView
performSelector:@selector(noteHeightOfRowsWithIndexesChanged:)
withObject:[NSIndexSet indexSetWithIndex:theIndex] afterDelay:0.0];
}
}
@@ -1510,8 +1510,8 @@
}
}
}
- float w = fmax(NSWidth(rect[0]), NSWidth(rect[1]));
- float h = fmax(NSHeight(rect[0]), NSHeight(rect[1]));
+ float w = fmaxf(NSWidth(rect[0]), NSWidth(rect[1]));
+ float h = fmaxf(NSHeight(rect[0]), NSHeight(rect[1]));
for (j = 0; j < 2; j++)
rect[j] = NSMakeRect(floorf(NSMidX(rect[j]) - 0.5 * w),
floorf(NSMidY(rect[j]) - 0.5 * h), w, h);
rectArray = [NSArray arrayWithObjects:[NSValue valueWithRect:rect[0]],
[NSValue valueWithRect:rect[1]], nil];
@@ -1584,8 +1584,8 @@
for (i = 0; i < iMax; i++) {
NSRect bbox = [[pdfDoc pageAtIndex:i] foregroundBox];
- size.width = fmax(size.width, NSWidth(bbox));
- size.height = fmax(size.height, NSHeight(bbox));
+ size.width = fmaxf(size.width, NSWidth(bbox));
+ size.height = fmaxf(size.height, NSHeight(bbox));
[progressBar incrementBy:1.0];
[progressBar displayIfNeeded];
if (i && i % 10 == 0)
@@ -1765,7 +1765,7 @@
- (void)transitionSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo {
if (returnCode == NSOKButton) {
[pdfView setTransitionStyle:[[transitionStylePopUpButton selectedItem]
tag]];
- [pdfView setTransitionDuration:fmax([transitionDurationField
floatValue], 0.0)];
+ [pdfView setTransitionDuration:fmaxf([transitionDurationField
floatValue], 0.0)];
[pdfView setTransitionShouldRestrict:(BOOL)[[transitionExtentMatrix
selectedCell] tag]];
}
}
@@ -3757,7 +3757,7 @@
[image lockFocus];
NSRect imgRect = NSZeroRect;
imgRect.size = [image size];
- float width = 0.8 * fmin(NSWidth(imgRect), NSHeight(imgRect));
+ float width = 0.8 * fminf(NSWidth(imgRect), NSHeight(imgRect));
imgRect = NSInsetRect(imgRect, 0.5 * (NSWidth(imgRect) - width), 0.5 *
(NSHeight(imgRect) - width));
[[NSImage imageNamed:@"NSApplicationIcon"] drawInRect:imgRect
fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.5];
[image unlockFocus];
@@ -3779,7 +3779,7 @@
float defaultSize = roundedThumbnailSize;
float thumbnailSize = (defaultSize < 32.1) ? 32.0 : (defaultSize < 64.1) ?
64.0 : (defaultSize < 128.1) ? 128.0 : 256.0;
- if (fabs(thumbnailSize - thumbnailCacheSize) > 0.1) {
+ if (fabsf(thumbnailSize - thumbnailCacheSize) > 0.1) {
thumbnailCacheSize = thumbnailSize;
if ([self countOfThumbnails])
@@ -3882,7 +3882,7 @@
float defaultSize = roundedSnapshotThumbnailSize;
float snapshotSize = (defaultSize < 32.1) ? 32.0 : (defaultSize < 64.1) ?
64.0 : (defaultSize < 128.1) ? 128.0 : 256.0;
- if (fabs(snapshotSize - snapshotCacheSize) > 0.1) {
+ if (fabsf(snapshotSize - snapshotCacheSize) > 0.1) {
snapshotCacheSize = snapshotSize;
if (snapshotTimer) {
@@ -3923,7 +3923,7 @@
[dirtySnapshots removeObject:controller];
newSize = [image size];
- if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height -
oldSize.height) > 1.0) {
+ if (fabsf(newSize.width - oldSize.width) > 1.0 || fabsf(newSize.height
- oldSize.height) > 1.0) {
unsigned index = [[snapshotArrayController arrangedObjects]
indexOfObject:controller];
[snapshotTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet
indexSetWithIndex:index]];
}
@@ -4535,7 +4535,7 @@
} else if ([identifier
isEqualToString:SKDocumentToolbarZoomToFitItemIdentifier]) {
return [pdfView autoScales] == NO;
} else if ([identifier
isEqualToString:SKDocumentToolbarZoomActualItemIdentifier]) {
- return fabs([pdfView scaleFactor] - 1.0) > 0.01;
+ return fabsf([pdfView scaleFactor] - 1.0) > 0.01;
} else if ([identifier
isEqualToString:SKDocumentToolbarCropItemIdentifier]) {
return YES;
} else if ([identifier
isEqualToString:SKDocumentToolbarFullScreenItemIdentifier]) {
@@ -4618,7 +4618,7 @@
} else if (action == @selector(doZoomOut:)) {
return [self isPresentation] == NO && [pdfView canZoomOut];
} else if (action == @selector(doZoomToActualSize:)) {
- return fabs([pdfView scaleFactor] - 1.0 ) > 0.01;
+ return fabsf([pdfView scaleFactor] - 1.0 ) > 0.01;
} else if (action == @selector(doZoomToPhysicalSize:)) {
return [self isPresentation] == NO;
} else if (action == @selector(doZoomToSelection:)) {
Modified: trunk/SKNoteOutlineView.m
===================================================================
--- trunk/SKNoteOutlineView.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKNoteOutlineView.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -68,7 +68,7 @@
case NSLeftMouseDragged:
{
NSPoint currentPoint = [self convertPoint:[theEvent
locationInWindow] fromView:nil];
- float currentHeight = fmax([self rowHeight], startHeight +
currentPoint.y - startPoint.y);
+ float currentHeight = fmaxf([self rowHeight], startHeight +
currentPoint.y - startPoint.y);
[[self delegate] outlineView:self setHeightOfRow:currentHeight
byItem:item];
[self noteHeightOfRowsWithIndexesChanged:[NSIndexSet
indexSetWithIndex:row]];
Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKPDFAnnotationNote.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -815,10 +815,10 @@
}
static BOOL adjacentCharacterBounds(NSRect rect1, NSRect rect2) {
- float w = fmax(NSWidth(rect2), NSWidth(rect1));
- float h = fmax(NSHeight(rect2), NSHeight(rect1));
+ float w = fmaxf(NSWidth(rect2), NSWidth(rect1));
+ float h = fmaxf(NSHeight(rect2), NSHeight(rect1));
// first check the vertical position; allow sub/superscripts
- if (fabs(NSMinY(rect1) - NSMinY(rect2)) > 0.2 * h && fabs(NSMaxY(rect1) -
NSMaxY(rect2)) > 0.2 * h)
+ if (fabsf(NSMinY(rect1) - NSMinY(rect2)) > 0.2 * h && fabsf(NSMaxY(rect1)
- NSMaxY(rect2)) > 0.2 * h)
return NO;
// compare horizontal position
// rect1 before rect2
@@ -1430,8 +1430,8 @@
} else {
point = SKSubstractPoints(point, bounds.origin);
- return (fabs(point.x - startPoint.x) < 3.5 && fabs(point.y -
startPoint.y) < 3.5) ||
- (fabs(point.x - endPoint.x) < 3.5 && fabs(point.y - endPoint.y)
< 3.5);
+ return (fabsf(point.x - startPoint.x) < 3.5 && fabsf(point.y -
startPoint.y) < 3.5) ||
+ (fabsf(point.x - endPoint.x) < 3.5 && fabsf(point.y -
endPoint.y) < 3.5);
}
}
Modified: trunk/SKPDFHoverWindow.m
===================================================================
--- trunk/SKPDFHoverWindow.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKPDFHoverWindow.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -202,8 +202,8 @@
PDFSelection *selection = [page selectionForRect:bounds];
if ([selection string]) {
NSRect selBounds = [selection boundsForPage:page];
- float top = ceilf(fmax(NSMaxY(selBounds), NSMinX(selBounds) +
NSHeight(sourceRect)));
- float left = floorf(fmin(NSMinX(selBounds), NSMaxX(bounds) -
NSWidth(sourceRect)));
+ float top = ceilf(fmaxf(NSMaxY(selBounds), NSMinX(selBounds) +
NSHeight(sourceRect)));
+ float left = floorf(fminf(NSMinX(selBounds), NSMaxX(bounds) -
NSWidth(sourceRect)));
if (top < NSMaxY(sourceRect))
sourceRect.origin.y = top - NSHeight(sourceRect);
if (left > NSMinX(sourceRect))
@@ -270,7 +270,7 @@
NSRect textRect = [text boundingRectWithSize:NSInsetRect(contentRect,
TEXT_MARGIN_X, TEXT_MARGIN_Y).size
options:NSStringDrawingUsesLineFragmentOrigin];
- textRect.size.height = fmin(NSHeight(textRect), NSHeight(contentRect)
- 2.0 * TEXT_MARGIN_Y);
+ textRect.size.height = fminf(NSHeight(textRect), NSHeight(contentRect)
- 2.0 * TEXT_MARGIN_Y);
textRect.origin = NSMakePoint(TEXT_MARGIN_X, TEXT_MARGIN_Y);
image = [[NSImage alloc]
initWithSize:NSInsetRect(NSIntegralRect(textRect), -TEXT_MARGIN_X,
-TEXT_MARGIN_X).size];
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKPDFSynchronizer.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -456,7 +456,7 @@
afterRecord = record;
break;
} else {
- [atRecords setObject:record forKey:[NSNumber
numberWithFloat:fabs(x - point.x)]];
+ [atRecords setObject:record forKey:[NSNumber
numberWithFloat:fabsf(x - point.x)]];
}
}
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKPDFView.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -2859,14 +2859,14 @@
if ([theEvent modifierFlags] & NSShiftKeyMask) {
NSPoint *fixedPoint = draggingStartPoint ? &endPoint :
&startPoint;
NSPoint diffPoint = SKSubstractPoints(*draggedPoint,
*fixedPoint);
- float dx = fabs(diffPoint.x), dy = fabs(diffPoint.y);
+ float dx = fabsf(diffPoint.x), dy = fabsf(diffPoint.y);
if (dx < 0.4 * dy) {
diffPoint.x = 0.0;
} else if (dy < 0.4 * dx) {
diffPoint.y = 0.0;
} else {
- dx = fmin(dx, dy);
+ dx = fminf(dx, dy);
diffPoint.x = diffPoint.x < 0.0 ? -dx : dx;
diffPoint.y = diffPoint.y < 0.0 ? -dx : dx;
}
@@ -3650,7 +3650,7 @@
static CGMutablePathRef SKCGCreatePathWithRoundRectInRect(CGRect rect, float
radius)
{
// Make sure radius doesn't exceed a maximum size to avoid artifacts:
- radius = fmin(radius, 0.5f * fmin(rect.size.width, rect.size.height));
+ radius = fminf(radius, 0.5f * fminf(rect.size.width, rect.size.height));
CGMutablePathRef path = CGPathCreateMutable();
Modified: trunk/SKSplitView.m
===================================================================
--- trunk/SKSplitView.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKSplitView.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -100,7 +100,7 @@
[NSBezierPath setDefaultLineWidth:1.0];
if ([self isVertical]) {
- handleSize = fmin(handleSize, 2.0 * floorf(0.5 * NSHeight(aRect)));
+ handleSize = fminf(handleSize, 2.0 * floorf(0.5 * NSHeight(aRect)));
startPoint = NSMakePoint(NSMinX(aRect) + 1.5, NSMidY(aRect) - 0.5 *
handleSize);
endPoint = NSMakePoint(startPoint.x, startPoint.y + handleSize);
[darkColor set];
@@ -116,7 +116,7 @@
endPoint.x += 2.0;
[NSBezierPath strokeLineFromPoint:startPoint toPoint:endPoint];
} else {
- handleSize = fmin(handleSize, 2.0 * floorf(0.5 * NSWidth(aRect)));
+ handleSize = fminf(handleSize, 2.0 * floorf(0.5 * NSWidth(aRect)));
startPoint = NSMakePoint(NSMidX(aRect) - 0.5 * handleSize,
NSMinY(aRect) + 1.5);
endPoint = NSMakePoint(startPoint.x + handleSize, startPoint.y);
[darkColor set];
Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKStatusBar.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -100,7 +100,7 @@
if (textRect.size.width < 0.0)
textRect.size.width = 0.0;
- float height = fmax([leftCell cellSize].height, [rightCell
cellSize].height);
+ float height = fmaxf([leftCell cellSize].height, [rightCell
cellSize].height);
textRect.origin.y += 0.5f * (NSHeight(textRect) - height);
textRect.origin.y = [self isFlipped] ? ceilf(NSMinY(textRect)) :
floorf(NSMinY(textRect));
textRect.size.height = height;
Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m 2007-08-27 19:57:17 UTC (rev 2736)
+++ trunk/SKThumbnailTableView.m 2007-08-27 20:17:28 UTC (rev 2737)
@@ -177,7 +177,7 @@
- (NSSize)cellSize {
NSSize size = [super cellSize];
- size.width = fmax(size.width, 12.0);
+ size.width = fmaxf(size.width, 12.0);
return size;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit