org.xwt.util
Class DirtyList

java.lang.Object
  extended byorg.xwt.util.DirtyList

public class DirtyList
extends java.lang.Object

A general-purpose data structure for holding a list of rectangular regions that need to be repainted, with intelligent coalescing. DirtyList will unify two regions A and B if the smallest rectangle enclosing both A and B occupies no more than epsilon + Area_A + Area_B. Failing this, if two corners of A fall within B, A will be shrunk to exclude the union of A and B.


Constructor Summary
DirtyList()
           
 
Method Summary
 boolean dirty(int x, int y, int w, int h)
          Add a new rectangle to the dirty list; returns false if the region fell completely within an existing rectangle or set of rectangles (ie did not expand the dirty area)
 boolean empty()
          Returns true if there are no regions that need repainting
 int[][] flush()
          Atomically returns the list of dirty rectangles as an array of four-int arrays and clears the internal dirty-rectangle list.
 int num()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirtyList

public DirtyList()
Method Detail

num

public int num()

dirty

public boolean dirty(int x,
                     int y,
                     int w,
                     int h)
Add a new rectangle to the dirty list; returns false if the region fell completely within an existing rectangle or set of rectangles (ie did not expand the dirty area)


empty

public boolean empty()
Returns true if there are no regions that need repainting


flush

public int[][] flush()
Atomically returns the list of dirty rectangles as an array of four-int arrays and clears the internal dirty-rectangle list. Note that some of the regions returned may be null, or may have zero height or zero width, and do not need to be repainted.