A method and apparatus for high-performance rendering and hit-testing of a window
tree is provided. A window tree may be rendered using an application programming
interface provided by the present invention. The application programming interface
provides support for world-transforms, enabling entire sub-trees of the window
tree to be rotated and scaled during rendering. In order to quickly render and
hit-test the transformed nodes of the window tree, a stack-based implementation
of the "painter's algorithm" is utilized to achieve fast rendering. By storing
all state information on a stack regarding each node in the window tree and building
new data structures containing rendering information for each node and its children,
any portion of the sub tree may be rendered on demand.