Revision: 5258
http://skim-app.svn.sourceforge.net/skim-app/?rev=5258&view=rev
Author: hofman
Date: 2009-03-15 21:18:38 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
Use inlined defined functions to convert from CG to NS geometry
Modified Paths:
--------------
trunk/BDSKGradientView.m
trunk/NSBezierPath_CoreImageExtensions.m
trunk/SKPDFView.m
trunk/SKSplitView.m
trunk/SKStatusBar.m
trunk/SKTransitionController.m
Modified: trunk/BDSKGradientView.m
===================================================================
--- trunk/BDSKGradientView.m 2009-03-14 15:36:26 UTC (rev 5257)
+++ trunk/BDSKGradientView.m 2009-03-15 21:18:38 UTC (rev 5258)
@@ -114,7 +114,7 @@
if (NULL == layer) {
NSSize layerSize = bounds.size;
- layer = CGLayerCreateWithContext(viewContext, *(CGSize
*)&layerSize, NULL);
+ layer = CGLayerCreateWithContext(viewContext,
NSSizeToCGSize(layerSize), NULL);
CGContextRef layerContext = CGLayerGetContext(layer);
[NSGraphicsContext saveGraphicsState];
@@ -128,7 +128,7 @@
// normal blend mode is copy
CGContextSetBlendMode(viewContext, kCGBlendModeNormal);
- CGContextDrawLayerInRect(viewContext, *(CGRect *)&bounds, layer);
+ CGContextDrawLayerInRect(viewContext, NSRectToCGRect(bounds), layer);
}
}
Modified: trunk/NSBezierPath_CoreImageExtensions.m
===================================================================
--- trunk/NSBezierPath_CoreImageExtensions.m 2009-03-14 15:36:26 UTC (rev
5257)
+++ trunk/NSBezierPath_CoreImageExtensions.m 2009-03-15 21:18:38 UTC (rev
5258)
@@ -51,7 +51,7 @@
- (void)fillPathVertically:(BOOL)isVertical withStartColor:(CIColor
*)startColor endColor:(CIColor *)endColor;
{
NSRect bounds = [self bounds];
- CGRect aRect = *(CGRect*)&bounds;
+ CGRect aRect = NSRectToCGRect(bounds);
CGPoint startPoint = aRect.origin;
CGPoint endPoint = startPoint;
@@ -80,7 +80,7 @@
- (void)fillPathWithHorizontalGradientFromColor:(CIColor *)fgStartColor
toColor:(CIColor *)fgEndColor blendedAtTop:(BOOL)top
ofVerticalGradientFromColor:(CIColor *)bgStartColor toColor:(CIColor
*)bgEndColor;
{
NSRect bounds = [self bounds];
- CGRect aRect = *(CGRect*)&bounds;
+ CGRect aRect = NSRectToCGRect(bounds);
CIImage *image = [CIImage imageInRect:aRect
withHorizontalGradientFromColor:fgStartColor toColor:fgEndColor
blendedAtTop:top ofVerticalGradientFromColor:bgStartColor toColor:bgEndColor];
@@ -97,7 +97,7 @@
- (void)fillPathWithVerticalGradientFromColor:(CIColor *)fgStartColor
toColor:(CIColor *)fgEndColor blendedAtRight:(BOOL)right
ofHorizontalGradientFromColor:(CIColor *)bgStartColor toColor:(CIColor
*)bgEndColor;
{
NSRect bounds = [self bounds];
- CGRect aRect = *(CGRect*)&bounds;
+ CGRect aRect = NSRectToCGRect(bounds);
CIImage *image = [CIImage imageInRect:aRect
withVerticalGradientFromColor:fgStartColor toColor:fgEndColor
blendedAtRight:right ofHorizontalGradientFromColor:bgStartColor
toColor:bgEndColor];
@@ -114,7 +114,7 @@
- (void)fillPathWithColor:(CIColor *)fgColor blendedAtRight:(BOOL)right
ofVerticalGradientFromColor:(CIColor *)bgStartColor toColor:(CIColor
*)bgEndColor;
{
NSRect bounds = [self bounds];
- CGRect aRect = *(CGRect*)&bounds;
+ CGRect aRect = NSRectToCGRect(bounds);
CIImage *image = [CIImage imageInRect:aRect withColor:fgColor
blendedAtRight:right ofVerticalGradientFromColor:bgStartColor
toColor:bgEndColor];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-03-14 15:36:26 UTC (rev 5257)
+++ trunk/SKPDFView.m 2009-03-15 21:18:38 UTC (rev 5258)
@@ -369,7 +369,7 @@
NSRect bounds = [activeAnnotation bounds];
NSRect rect = NSInsetRect(NSIntegralRect(bounds), 0.5 * lineWidth, 0.5
* lineWidth);
if (isLink) {
- CGMutablePathRef path = SKCGCreatePathWithRoundRectInRect(*(CGRect
*)&rect, floorf(0.3 * NSHeight(rect)));
+ CGMutablePathRef path =
SKCGCreatePathWithRoundRectInRect(NSRectToCGRect(rect), floorf(0.3 *
NSHeight(rect)));
float color[4] = { 0.0, 0.0, 0.0, 0.1 };
CGContextSetFillColor(context, color);
CGContextBeginPath(context);
@@ -383,15 +383,15 @@
CGPathRelease(path);
} else if ([[activeAnnotation type] isEqualToString:SKNLineString]) {
NSPoint point = SKAddPoints(bounds.origin, [(PDFAnnotationLine
*)activeAnnotation startPoint]);
- SKCGContextDrawGrabHandle(context, *(CGPoint *)&point, 4.0,
dragMask == BDSKMaxXEdgeMask);
+ SKCGContextDrawGrabHandle(context, NSPointToCGPoint(point), 4.0,
dragMask == BDSKMaxXEdgeMask);
point = SKAddPoints(bounds.origin, [(PDFAnnotationLine
*)activeAnnotation endPoint]);
- SKCGContextDrawGrabHandle(context, *(CGPoint *)&point, 4.0,
dragMask == BDSKMinXEdgeMask);
+ SKCGContextDrawGrabHandle(context, NSPointToCGPoint(point), 4.0,
dragMask == BDSKMinXEdgeMask);
} else if (editField == nil) {
float color[4] = { 0.278477, 0.467857, 0.810941, 1.0 };
CGContextSetStrokeColor(context, color);
- CGContextStrokeRectWithWidth(context, *(CGRect *)&rect, lineWidth);
+ CGContextStrokeRectWithWidth(context, NSRectToCGRect(rect),
lineWidth);
if ([activeAnnotation isResizable])
- SKCGContextDrawGrabHandles(context, *(CGRect *)&bounds, 4.0,
dragMask);
+ SKCGContextDrawGrabHandles(context, NSRectToCGRect(bounds),
4.0, dragMask);
}
}
@@ -400,7 +400,7 @@
NSRect bounds = [highlightAnnotation bounds];
NSRect rect = NSInsetRect(NSIntegralRect(bounds), 0.5, 0.5);
CGContextSetStrokeColor(context, color);
- CGContextStrokeRectWithWidth(context, *(CGRect *)&rect, 1.0);
+ CGContextStrokeRectWithWidth(context, NSRectToCGRect(rect), 1.0);
}
if (readingBar) {
@@ -414,17 +414,17 @@
if (invert) {
NSRect bounds = [pdfPage boundsForBox:[self displayBox]];
if (NSEqualRects(rect, NSZeroRect) || [[readingBar page]
isEqual:pdfPage] == NO) {
- CGContextFillRect(context, *(CGRect *)&bounds);
+ CGContextFillRect(context, NSRectToCGRect(bounds));
} else {
NSRect outRect, ignored;
NSDivideRect(bounds, &outRect, &ignored, NSMaxY(bounds) -
NSMaxY(rect), NSMaxYEdge);
- CGContextFillRect(context, *(CGRect *)&outRect);
+ CGContextFillRect(context, NSRectToCGRect(outRect));
NSDivideRect(bounds, &outRect, &ignored, NSMinY(rect) -
NSMinY(bounds), NSMinYEdge);
- CGContextFillRect(context, *(CGRect *)&outRect);
+ CGContextFillRect(context, NSRectToCGRect(outRect));
}
} else if ([[readingBar page] isEqual:pdfPage]) {
CGContextSetBlendMode(context, kCGBlendModeMultiply);
- CGContextFillRect(context, *(CGRect *)&rect);
+ CGContextFillRect(context, NSRectToCGRect(rect));
}
}
@@ -432,22 +432,22 @@
NSRect rect = NSInsetRect([self convertRect:selectionRect
toPage:pdfPage], 0.5, 0.5);
float color[4] = { 0.0, 0.0, 0.0, 1.0 };
CGContextSetStrokeColor(context, color);
- CGContextStrokeRect(context, *(CGRect *)&rect);
+ CGContextStrokeRect(context, NSRectToCGRect(rect));
} else if (toolMode == SKSelectToolMode && (didSelect ||
NSEqualRects(selectionRect, NSZeroRect) == NO)) {
NSRect bounds = [pdfPage boundsForBox:[self displayBox]];
float color[4] = { 0.0, 0.0, 0.0, 0.6 };
float radius = 4.0 / [self scaleFactor];
CGContextBeginPath(context);
- CGContextAddRect(context, *(CGRect *)&bounds);
- CGContextAddRect(context, *(CGRect *)&selectionRect);
+ CGContextAddRect(context, NSRectToCGRect(bounds));
+ CGContextAddRect(context, NSRectToCGRect(selectionRect));
CGContextSetFillColor(context, color);
CGContextEOFillPath(context);
if ([pdfPage pageIndex] != selectionPageIndex) {
color[3] = 0.3;
CGContextSetFillColor(context, color);
- CGContextFillRect(context, *(CGRect *)&selectionRect);
+ CGContextFillRect(context, NSRectToCGRect(selectionRect));
}
- SKCGContextDrawGrabHandles(context, *(CGRect *)&selectionRect, radius,
[pdfPage isEqual:[self currentPage]] ? dragMask : 0);
+ SKCGContextDrawGrabHandles(context, NSRectToCGRect(selectionRect),
radius, [pdfPage isEqual:[self currentPage]] ? dragMask : 0);
}
CGContextRestoreGState(context);
Modified: trunk/SKSplitView.m
===================================================================
--- trunk/SKSplitView.m 2009-03-14 15:36:26 UTC (rev 5257)
+++ trunk/SKSplitView.m 2009-03-15 21:18:38 UTC (rev 5258)
@@ -117,7 +117,7 @@
[[NSBezierPath bezierPathWithRect:rectToFill] fillPathVertically:NO ==
[self isVertical] withStartColor:[[self class] startColor] endColor:[[self
class] endColor]];
[NSGraphicsContext restoreGraphicsState];
}
- CGContextDrawLayerInRect(currentContext, *(CGRect *)&aRect, dividerLayer);
+ CGContextDrawLayerInRect(currentContext, NSRectToCGRect(aRect),
dividerLayer);
if (blendEnds) {
NSRect endRect, ignored;
@@ -134,7 +134,7 @@
[[NSBezierPath bezierPathWithRect:rectToFill]
fillPathVertically:[self isVertical] withStartColor:[[self class] endColor]
endColor:[CIColor clearColor]];
[NSGraphicsContext restoreGraphicsState];
}
- CGContextDrawLayerInRect(currentContext, *(CGRect *)&endRect,
minBlendLayer);
+ CGContextDrawLayerInRect(currentContext, NSRectToCGRect(endRect),
minBlendLayer);
NSDivideRect(aRect, &endRect, &ignored, END_JOIN_WIDTH, [self
isVertical] ? NSMaxYEdge : NSMaxXEdge);
if (NULL == maxBlendLayer) {
@@ -148,7 +148,7 @@
[[NSBezierPath bezierPathWithRect:rectToFill]
fillPathVertically:[self isVertical] withStartColor:[CIColor clearColor]
endColor:[[self class] startColor]];
[NSGraphicsContext restoreGraphicsState];
}
- CGContextDrawLayerInRect(currentContext, *(CGRect *)&endRect,
maxBlendLayer);
+ CGContextDrawLayerInRect(currentContext, NSRectToCGRect(endRect),
maxBlendLayer);
}
[NSGraphicsContext saveGraphicsState];
Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2009-03-14 15:36:26 UTC (rev 5257)
+++ trunk/SKStatusBar.m 2009-03-15 21:18:38 UTC (rev 5258)
@@ -164,7 +164,7 @@
if (NULL == layer) {
NSSize layerSize = bounds.size;
- layer = CGLayerCreateWithContext(viewContext, *(CGSize *)&layerSize,
NULL);
+ layer = CGLayerCreateWithContext(viewContext,
NSSizeToCGSize(layerSize), NULL);
CGContextRef layerContext = CGLayerGetContext(layer);
[NSGraphicsContext saveGraphicsState];
@@ -179,7 +179,7 @@
// normal blend mode is copy
CGContextSaveGState(viewContext);
CGContextSetBlendMode(viewContext, kCGBlendModeNormal);
- CGContextDrawLayerInRect(viewContext, *(CGRect *)&bounds, layer);
+ CGContextDrawLayerInRect(viewContext, NSRectToCGRect(bounds), layer);
CGContextRestoreGState(viewContext);
NSRect textRect, ignored;
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2009-03-14 15:36:26 UTC (rev 5257)
+++ trunk/SKTransitionController.m 2009-03-15 21:18:38 UTC (rev 5258)
@@ -593,7 +593,7 @@
CIImage *currentImage = [self currentImage];
if (currentImage) {
NSRect bounds = [self bounds];
- [[self ciContext] drawImage:currentImage inRect:*(CGRect*)&bounds
fromRect:*(CGRect*)&bounds];
+ [[self ciContext] drawImage:currentImage inRect:NSRectToCGRect(bounds)
fromRect:NSRectToCGRect(bounds)];
}
glFlush();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit