In order to fix bug#28929 I switched back the JViewport to use
backingstore scrollmode. This has similar performance characteristics
like the blitting scrollmode, but is much more reliable in my
experience. I think I implemented the blitting scrollmode wrong anyway
and need to reimplement this. For the time beeing it makes sense to use
the backingstore scrolling.
2006-09-29 Roman Kennke <[EMAIL PROTECTED]>
PR 28929
* javax/swing/JViewport.java
(cinit): Renamed system property to gnu.swing.scrollmode
to avoid bloat. Default to BACKINGSTORE, this is much
more reliable.
(repaint): Forward repaint() to parent as is specified.
/Roman
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.48
diff -u -1 -5 -r1.48 JViewport.java
--- javax/swing/JViewport.java 21 Sep 2006 10:04:26 -0000 1.48
+++ javax/swing/JViewport.java 29 Sep 2006 14:30:40 -0000
@@ -240,32 +240,31 @@
boolean sizeChanged = true;
/**
* Indicates if this JViewport is the paint root or not. If it is not, then
* we may not assume that the offscreen buffer still has the right content
* because parent components may have cleared the background already.
*/
private boolean isPaintRoot = false;
/**
* Initializes the default setting for the scrollMode property.
*/
static
{
String scrollModeProp =
- SystemProperties.getProperty("gnu.javax.swing.JViewport.scrollMode",
- "BLIT");
+ SystemProperties.getProperty("gnu.swing.scrollmode", "BACKINGSTORE");
if (scrollModeProp.equalsIgnoreCase("simple"))
defaultScrollMode = SIMPLE_SCROLL_MODE;
else if (scrollModeProp.equalsIgnoreCase("backingstore"))
defaultScrollMode = BACKINGSTORE_SCROLL_MODE;
else
defaultScrollMode = BLIT_SCROLL_MODE;
}
public JViewport()
{
setOpaque(true);
setScrollMode(defaultScrollMode);
updateUI();
setLayout(createLayoutManager());
lastPaintPosition = new Point();
@@ -615,43 +614,35 @@
return accessibleContext;
}
/**
* Forward repaint to parent to make sure only one paint is performed by the
* RepaintManager.
*
* @param tm number of milliseconds to defer the repaint request
* @param x the X coordinate of the upper left corner of the dirty area
* @param y the Y coordinate of the upper left corner of the dirty area
* @param w the width of the dirty area
* @param h the height of the dirty area
*/
public void repaint(long tm, int x, int y, int w, int h)
{
-// Component parent = getParent();
-// if (parent != null)
-// parent.repaint(tm, x + getX(), y + getY(), w, h);
-// else
-// super.repaint(tm, x, y, w, h);
-
- // The specs suggest to implement something like the above. This however
- // breaks blit painting, because the parent (most likely a JScrollPane)
- // clears the background of the offscreen area of the JViewport, thus
- // destroying the pieces that we want to clip. So we simply call super here
- // instead.
- super.repaint(tm, x, y, w, h);
-
+ Component parent = getParent();
+ if (parent != null)
+ parent.repaint(tm, x + getX(), y + getY(), w, h);
+ else
+ super.repaint(tm, x, y, w, h);
}
protected void addImpl(Component comp, Object constraints, int index)
{
if (getComponentCount() > 0)
remove(getComponents()[0]);
super.addImpl(comp, constraints, index);
}
protected void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
for (int i = 0; i < listeners.length; ++i)
listeners[i].stateChanged(changeEvent);