adium 3164:eba2ce3c92a4: Draw alternating rows over a background...

commits at adium.im commits at adium.im
Thu Mar 25 16:32:43 UTC 2010


details:	http://hg.adium.im/adium/rev/eba2ce3c92a4
revision:	3164:eba2ce3c92a4
author:		Stephen Holt <sholt at adium.im>
date:		Thu Mar 25 11:39:19 2010 -0400

Draw alternating rows over a background image if present.
Subject: adium 3165:6140e52d3390: Rework our contact list drawing to blend alpha's more predictably.

details:	http://hg.adium.im/adium/rev/6140e52d3390
revision:	3165:6140e52d3390
author:		Stephen Holt <sholt at adium.im>
date:		Thu Mar 25 12:32:24 2010 -0400

Rework our contact list drawing to blend alpha's more predictably.

  * Alternating row colors may now be semi-transparent
  * Alternating row colors will now compost over background images
  * Window opacity will now alter background images in addition to alternating rows.

diffs (100 lines):

diff -r 0572e73911b5 -r 6140e52d3390 Frameworks/AIUtilities Framework/Source/AIAlternatingRowOutlineView.m
--- a/Frameworks/AIUtilities Framework/Source/AIAlternatingRowOutlineView.m	Wed Mar 24 15:15:16 2010 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AIAlternatingRowOutlineView.m	Thu Mar 25 12:32:24 2010 -0400
@@ -140,7 +140,7 @@
 
 	if (rectNumber > 0) {
 		[[self alternatingRowColor] set];
-		NSRectFillList(gridRects, rectNumber);
+		NSRectFillListUsingOperation(gridRects, rectNumber, NSCompositeSourceOver);
 	}
 }
 
diff -r 0572e73911b5 -r 6140e52d3390 Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m
--- a/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m	Wed Mar 24 15:15:16 2010 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m	Thu Mar 25 12:32:24 2010 -0400
@@ -227,7 +227,7 @@
 		
 		if (rectNumber > 0) {
 			[[self alternatingRowColor] set];
-			NSRectFillList(gridRects, rectNumber);
+			NSRectFillListUsingOperation(gridRects, rectNumber, NSCompositeSourceOver);
 		}		
 	}
 }
diff -r 0572e73911b5 -r 6140e52d3390 Frameworks/Adium Framework/Source/AIListOutlineView+Drawing.m
--- a/Frameworks/Adium Framework/Source/AIListOutlineView+Drawing.m	Wed Mar 24 15:15:16 2010 -0400
+++ b/Frameworks/Adium Framework/Source/AIListOutlineView+Drawing.m	Thu Mar 25 12:32:24 2010 -0400
@@ -37,15 +37,13 @@
 		[[self backgroundColor] set];
 		NSRectFill(clipRect);
 		
-		if([self conformsToProtocol:@protocol(AIAlternatingRowsProtocol)])
-			[(id<AIAlternatingRowsProtocol>)self drawAlternatingRowsInRect:clipRect];
-		
 		//Image
 		NSScrollView	*enclosingScrollView = [self enclosingScrollView];
 		if (backgroundImage && enclosingScrollView) {
 			NSRect	visRect = [enclosingScrollView documentVisibleRect];
 			NSSize	imageSize = [backgroundImage size];
 			NSRect	imageRect = NSMakeRect(0.0f, 0.0f, imageSize.width, imageSize.height);
+			CGFloat imageFade = backgroundFade * backgroundOpacity;
 			
 			switch (backgroundStyle) {
 					
@@ -54,7 +52,7 @@
 					[backgroundImage drawInRect:NSMakeRect(visRect.origin.x, visRect.origin.y, imageSize.width, imageSize.height)
 									   fromRect:imageRect
 									  operation:NSCompositeSourceOver
-									   fraction:backgroundFade];
+									   fraction:imageFade];
 					break;
 				}
 				case AIFillProportionatelyBackground: {
@@ -72,7 +70,7 @@
 					[backgroundImage drawInRect:visRect
 									   fromRect:imageRect
 									  operation:NSCompositeSourceOver
-									   fraction:backgroundFade];
+									   fraction:imageFade];
 					break;
 				}
 				case AIFillStretchBackground: {
@@ -80,7 +78,7 @@
 					[backgroundImage drawInRect:visRect
 									   fromRect:imageRect
 									  operation:NSCompositeSourceOver
-									   fraction:backgroundFade];
+									   fraction:imageFade];
 					break;
 				}
 				case AITileBackground: {
@@ -101,7 +99,7 @@
 								[backgroundImage drawInRect:drawingRect
 												   fromRect:imageRect
 												  operation:NSCompositeSourceOver
-												   fraction:backgroundFade];
+												   fraction:imageFade];
 							}
 							
 							//Shift right for the next iteration
@@ -121,6 +119,9 @@
 		[[NSColor clearColor] set];
 		NSRectFill(clipRect);
 	}
+	
+	if([self conformsToProtocol:@protocol(AIAlternatingRowsProtocol)])
+		[(id<AIAlternatingRowsProtocol>)self drawAlternatingRowsInRect:clipRect];
 }
 
 #pragma mark Background
@@ -255,7 +256,8 @@
 - (NSColor *)alternatingRowColor
 {
 	if (!_rowColorWithOpacity) {
-		_rowColorWithOpacity = [[rowColor colorWithAlphaComponent:backgroundOpacity] retain];
+		CGFloat rowAlpha = [rowColor alphaComponent];
+		_rowColorWithOpacity = [[rowColor colorWithAlphaComponent:(rowAlpha * backgroundOpacity)] retain];
 	}
 	
 	return _rowColorWithOpacity;




More information about the commits mailing list