Revision: 2827
http://skim-app.svn.sourceforge.net/skim-app/?rev=2827&view=rev
Author: hofman
Date: 2007-09-04 10:06:05 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
Check whether rect to highlight is visible before drawing.
Modified Paths:
--------------
trunk/SKThumbnailTableView.m
trunk/SKTocOutlineView.m
Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m 2007-09-04 16:56:47 UTC (rev 2826)
+++ trunk/SKThumbnailTableView.m 2007-09-04 17:06:05 UTC (rev 2827)
@@ -85,6 +85,7 @@
- (void)highlightSelectionInClipRect:(NSRect)clipRect {
NSColor *color = [self highlightColor];
int row;
+ NSRect rect;
[NSGraphicsContext saveGraphicsState];
@@ -92,24 +93,26 @@
NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes]
mutableCopy] autorelease];
NSArray *rows = [[self delegate] tableViewHighlightedRows:self];
- float factor = 0.5;
- int i, count = [rows count];
+ int i, count = MIN((int)[rows count], 5);
- for (i = 0; i < count && factor > 0.0; i++) {
+ for (i = 0; i < count; i++) {
row = [[rows objectAtIndex:i] intValue];
- [[[self backgroundColor] blendedColorWithFraction:factor
ofColor:color] setFill];
- factor -= 0.1;
- if ([rowIndexes containsIndex:row] == NO) {
- NSRectFill([self rectOfRow:row]);
- [rowIndexes addIndex:row];
+ rect = [self rectOfRow:row];
+ if (NSIntersectsRect(rect, clipRect) && [rowIndexes
containsIndex:row] == NO) {
+ [[[self backgroundColor] blendedColorWithFraction:0.5 - 0.1 *
i ofColor:color] setFill];
+ NSRectFill(rect);
}
+ [rowIndexes addIndex:row];
}
}
row = [self selectedRow];
if (row != -1) {
- [color setFill];
- NSRectFill([self rectOfRow:row]);
+ rect = [self rectOfRow:row];
+ if (NSIntersectsRect(rect, clipRect)) {
+ [color setFill];
+ NSRectFill([self rectOfRow:row]);
+ }
}
[NSGraphicsContext restoreGraphicsState];
Modified: trunk/SKTocOutlineView.m
===================================================================
--- trunk/SKTocOutlineView.m 2007-09-04 16:56:47 UTC (rev 2826)
+++ trunk/SKTocOutlineView.m 2007-09-04 17:06:05 UTC (rev 2827)
@@ -63,31 +63,33 @@
- (void)highlightSelectionInClipRect:(NSRect)clipRect {
NSColor *color = [self highlightColor];
int row;
+ NSRect rect;
[NSGraphicsContext saveGraphicsState];
if ([[self delegate]
respondsToSelector:@selector(outlineViewHighlightedRows:)]) {
NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes]
mutableCopy] autorelease];
NSArray *rows = [[self delegate] outlineViewHighlightedRows:self];
- float factor = 0.5;
- int i, count = [rows count];
+ int i, count = MIN((int)[rows count], 5);
for (i = 0; i < count; i++) {
row = [[rows objectAtIndex:i] intValue];
- [[[self backgroundColor] blendedColorWithFraction:factor
ofColor:color] set];
- factor -= 0.1;
- if ([rowIndexes containsIndex:row] == NO) {
- NSRectFill([self rectOfRow:row]);
- [rowIndexes addIndex:row];
+ rect = [self rectOfRow:row];
+ if (NSIntersectsRect(rect, clipRect) && [rowIndexes
containsIndex:row] == NO) {
+ [[[self backgroundColor] blendedColorWithFraction:0.5 - 0.1 *
i ofColor:color] setFill];
+ NSRectFill(rect);
}
- if (factor <= 0.0) break;
+ [rowIndexes addIndex:row];
}
}
row = [self selectedRow];
if (row != -1) {
- [color setFill];
- NSRectFill([self rectOfRow:row]);
+ rect = [self rectOfRow:row];
+ if (NSIntersectsRect(rect, clipRect)) {
+ [color setFill];
+ NSRectFill([self rectOfRow:row]);
+ }
}
[NSGraphicsContext restoreGraphicsState];
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