From: <de...@us...> - 2009-09-23 23:14:54
|
Revision: 1836 http://iterm.svn.sourceforge.net/iterm/?rev=1836&view=rev Author: delx Date: 2009-09-23 23:14:45 +0000 (Wed, 23 Sep 2009) Log Message: ----------- Only redraw "blinked" characters every 0.5 seconds, not entire screen Modified Paths: -------------- trunk/PTYTextView.m Modified: trunk/PTYTextView.m =================================================================== --- trunk/PTYTextView.m 2009-09-23 23:14:07 UTC (rev 1835) +++ trunk/PTYTextView.m 2009-09-23 23:14:45 UTC (rev 1836) @@ -531,16 +531,29 @@ dirty += WIDTH; } + // Time to redraw blinking text? + struct timeval now; + BOOL redrawBlink = NO; + gettimeofday(&now, NULL); + if(now.tv_sec*10+now.tv_usec/100000 >= lastBlink.tv_sec*10+lastBlink.tv_usec/100000+7) { + blinkShow = !blinkShow; + lastBlink = now; + redrawBlink = YES; + } + // Visible chars that have changed selection status are dirty + // Also mark blinking text as dirty if needed lineStart = [self visibleRect].origin.y / lineHeight; lineEnd = lineStart + ceil([self visibleRect].size.height / lineHeight); if(lineStart < 0) lineStart = 0; if(lineEnd > [dataSource numberOfLines]) lineEnd = [dataSource numberOfLines]; for(int y = lineStart; y < lineEnd; y++) { + screen_char_t* theLine = [dataSource getLineAtIndex:y]; for(int x = 0; x < WIDTH; x++) { BOOL isSelected = [self _isCharSelectedInRow:y col:x checkOld:NO]; BOOL wasSelected = [self _isCharSelectedInRow:y col:x checkOld:YES]; - if(isSelected != wasSelected) { + BOOL blinked = redrawBlink && (theLine[x].fg_color & BLINK_MASK); + if(isSelected != wasSelected || blinked) { NSRect dirtyRect = [self visibleRect]; dirtyRect.origin.y = y*lineHeight; dirtyRect.size.height = lineHeight; @@ -599,15 +612,6 @@ int height = [dataSource numberOfLines] * lineHeight; NSRect frame = [self frame]; - // Blinking - struct timeval now; - gettimeofday(&now, NULL); - if(now.tv_sec*10+now.tv_usec/100000 >= lastBlink.tv_sec*10+lastBlink.tv_usec/100000+7) { - blinkShow = !blinkShow; - lastBlink = now; - [self setNeedsDisplay:YES]; - } - if(height != frame.size.height) { // Grow to allow space for drawing the new lines // XXX - EPIC HACK below This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |