From: <kp...@us...> - 2007-12-28 09:54:48
|
Revision: 11464 http://jedit.svn.sourceforge.net/jedit/?rev=11464&view=rev Author: kpouer Date: 2007-12-28 01:54:47 -0800 (Fri, 28 Dec 2007) Log Message: ----------- added a toString() method to the RepaintLines class Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/textarea/FastRepaintManager.java Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/FastRepaintManager.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/FastRepaintManager.java 2007-12-28 06:17:38 UTC (rev 11463) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/FastRepaintManager.java 2007-12-28 09:54:47 UTC (rev 11464) @@ -44,6 +44,10 @@ } //}}} //{{{ updateGraphics() method + /** + * Prepare the graphics environment. + * This is only called by the TextAreaPainter when it is resized + */ void updateGraphics() { if(gfx != null) @@ -70,7 +74,7 @@ return gfx; } //}}} - //{{{ prepareGraphics() method + //{{{ RepaintLines class static class RepaintLines { final int first; @@ -81,6 +85,12 @@ this.first = first; this.last = last; } + + @Override + public String toString() + { + return "RepaintLines[" + first + ',' + last + ']'; + } } //}}} //{{{ prepareGraphics() method @@ -90,17 +100,17 @@ gfx.setFont(painter.getFont()); gfx.setColor(painter.getBackground()); - int height = gfx.getFontMetrics().getHeight(); + int lineHeight = gfx.getFontMetrics().getHeight(); if(fastScroll) { int lineDelta = this.firstLine - firstLine; - int yDelta = lineDelta * height; int visibleLines = textArea.getVisibleLines(); if(lineDelta > -visibleLines && lineDelta < visibleLines) { + int yDelta = lineDelta * lineHeight; if(lineDelta < 0) { gfx.copyArea(0,-yDelta,painter.getWidth(), @@ -124,8 +134,8 @@ // of the font height, we subtract 1 from it, otherwise one // too many lines will always be painted. return new RepaintLines( - clipRect.y / height, - (clipRect.y + clipRect.height - 1) / height); + clipRect.y / lineHeight, + (clipRect.y + clipRect.height - 1) / lineHeight); } //}}} //{{{ paint() method @@ -142,8 +152,8 @@ } //}}} //{{{ Private members - private TextArea textArea; - private TextAreaPainter painter; + private final TextArea textArea; + private final TextAreaPainter painter; private Graphics2D gfx; private Image img; private boolean fastScroll; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |