< prev index next >
src/java.desktop/share/classes/sun/awt/RepaintArea.java
Print this page
*** 29,39 ****
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.PaintEvent;
/**
! * The <code>RepaintArea</code> is a geometric construct created for the
* purpose of holding the geometry of several coalesced paint events.
* This geometry is accessed synchronously, although it is written such
* that painting may still be executed asynchronously.
*
* @author Eric Hawkes
--- 29,39 ----
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.PaintEvent;
/**
! * The {@code RepaintArea} is a geometric construct created for the
* purpose of holding the geometry of several coalesced paint events.
* This geometry is accessed synchronously, although it is written such
* that painting may still be executed asynchronously.
*
* @author Eric Hawkes
*** 57,77 ****
private Rectangle paintRects[] = new Rectangle[RECT_COUNT];
/**
! * Constructs a new <code>RepaintArea</code>
* @since 1.3
*/
public RepaintArea() {
}
/**
! * Constructs a new <code>RepaintArea</code> initialized to match
* the values of the specified RepaintArea.
*
! * @param ra the <code>RepaintArea</code> from which to copy initial
* values to a newly constructed RepaintArea
* @since 1.3
*/
private RepaintArea(RepaintArea ra) {
// This constructor is private because it should only be called
--- 57,77 ----
private Rectangle paintRects[] = new Rectangle[RECT_COUNT];
/**
! * Constructs a new {@code RepaintArea}
* @since 1.3
*/
public RepaintArea() {
}
/**
! * Constructs a new {@code RepaintArea} initialized to match
* the values of the specified RepaintArea.
*
! * @param ra the {@code RepaintArea} from which to copy initial
* values to a newly constructed RepaintArea
* @since 1.3
*/
private RepaintArea(RepaintArea ra) {
// This constructor is private because it should only be called
*** 80,95 ****
paintRects[i] = ra.paintRects[i];
}
}
/**
! * Adds a <code>Rectangle</code> to this <code>RepaintArea</code>.
* PAINT Rectangles are divided into mostly vertical and mostly horizontal.
* Each group is unioned together.
* UPDATE Rectangles are unioned.
*
! * @param r the specified <code>Rectangle</code>
* @param id possible values PaintEvent.UPDATE or PaintEvent.PAINT
* @since 1.3
*/
public synchronized void add(Rectangle r, int id) {
// Make sure this new rectangle has positive dimensions
--- 80,95 ----
paintRects[i] = ra.paintRects[i];
}
}
/**
! * Adds a {@code Rectangle} to this {@code RepaintArea}.
* PAINT Rectangles are divided into mostly vertical and mostly horizontal.
* Each group is unioned together.
* UPDATE Rectangles are unioned.
*
! * @param r the specified {@code Rectangle}
* @param id possible values PaintEvent.UPDATE or PaintEvent.PAINT
* @since 1.3
*/
public synchronized void add(Rectangle r, int id) {
// Make sure this new rectangle has positive dimensions
*** 107,121 ****
}
}
/**
! * Creates a new <code>RepaintArea</code> with the same geometry as this
* RepaintArea, then removes all of the geometry from this
* RepaintArea and restores it to an empty RepaintArea.
*
! * @return ra a new <code>RepaintArea</code> having the same geometry as
* this RepaintArea.
* @since 1.3
*/
private synchronized RepaintArea cloneAndReset() {
RepaintArea ra = new RepaintArea(this);
--- 107,121 ----
}
}
/**
! * Creates a new {@code RepaintArea} with the same geometry as this
* RepaintArea, then removes all of the geometry from this
* RepaintArea and restores it to an empty RepaintArea.
*
! * @return ra a new {@code RepaintArea} having the same geometry as
* this RepaintArea.
* @since 1.3
*/
private synchronized RepaintArea cloneAndReset() {
RepaintArea ra = new RepaintArea(this);
*** 184,194 ****
* rectangular clip region.
* If PAINT bounding rectangle is less than
* MAX_BENEFIT_RATIO times the benefit, then the vertical and horizontal unions are
* painted separately. Otherwise the entire bounding rectangle is painted.
*
! * @param target Component to <code>paint</code> or <code>update</code>
* @since 1.4
*/
public void paint(Object target, boolean shouldClearRectBeforePaint) {
Component comp = (Component)target;
--- 184,194 ----
* rectangular clip region.
* If PAINT bounding rectangle is less than
* MAX_BENEFIT_RATIO times the benefit, then the vertical and horizontal unions are
* painted separately. Otherwise the entire bounding rectangle is painted.
*
! * @param target Component to {@code paint} or {@code update}
* @since 1.4
*/
public void paint(Object target, boolean shouldClearRectBeforePaint) {
Component comp = (Component)target;
*** 246,265 ****
}
}
}
/**
! * Calls <code>Component.update(Graphics)</code> with given Graphics.
*/
protected void updateComponent(Component comp, Graphics g) {
if (comp != null) {
comp.update(g);
}
}
/**
! * Calls <code>Component.paint(Graphics)</code> with given Graphics.
*/
protected void paintComponent(Component comp, Graphics g) {
if (comp != null) {
comp.paint(g);
}
--- 246,265 ----
}
}
}
/**
! * Calls {@code Component.update(Graphics)} with given Graphics.
*/
protected void updateComponent(Component comp, Graphics g) {
if (comp != null) {
comp.update(g);
}
}
/**
! * Calls {@code Component.paint(Graphics)} with given Graphics.
*/
protected void paintComponent(Component comp, Graphics g) {
if (comp != null) {
comp.paint(g);
}
< prev index next >