JDK-4732249 : Performance and cleanup work on clipping implementation
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0,1.4.1
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2002-08-15
  • Updated: 2002-11-12
  • Resolved: 2002-11-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Related Reports
Duplicate :  
Relates :  
Description
The current implementation of complex and rectangular clipping in the
reference 2D port is sub-optimal in a few ways.

- Information is kept in redundant formats and locations.  For a
simple rectangular clip, the same information is kept in a Shape object,
a Rectangle object and 4 integer fields in the Graphics object which
store it in a more useful UpperLeft/LowerRight format.  For a
complex region, the bounds of the non-rectangular clip is also kept in
the Rectangle object and the 4 integer fields.  This wastes space.

- The preferred location of the information depends on the state
of the Graphics object.  If it is rectangular then the redundant extent
fields store all of the information about the clip.  If the clip is
non-rectangular, then an optional "Region" object must be consulted.
Multiple locations to retrieve clip information make it difficult to
write single pipelines that handle both rectangular and non-rectangular
clipping.

- None of the low level graphics primitives, or any of the platform
graphics pipelines handle complex clipping.  Some of this is due to
lack of engineering resources to add this capability and some of this
is due to the complexities listed above making this task more difficult
than it needs to be.

- Much of the manipulation of rectangular coordinates of the form
x,y,width,height is not properly checked for overflow which could
lead to undesired results (it should be pretty safe since the final
clipping is all done in an overflow-resistant UpperLeft/LowerRight
format, but we could end up calculating the wrong UL/LR values from
the XYWH values.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b07
14-06-2004

EVALUATION Committed to mantis. ###@###.### 2002-08-15 This work will be done in stages. The first stage will be to consolidate the clipping information into fewer objects. To that end, we will always store the clip in a Region object whether it is rectangular or complex. The Region object will be modified so as to provide an efficient means of representing a single rectangle in about the same amount of storage as one of the many redundant forms that we used to use to store the bounds of the clip. Then the redundant storage of the clip bounds will be eliminated and the net result will be a single format for the clip whatever form it is in which will take less overall storage than the previous implementation. This effort will also involve cleaning up the overflow handling for the code which deals with x,y,width,height rectangles passed in from the application code. The next step will be to start modifying the pipelines and primitives to push handling of complex clip regions into the lowest levels of the code. This should further simplify the implementation, save code and storage and boost the performance of our complex clip handling. ###@###.### 2002-08-15 Native code has been written to allow native primitives and pipelines to process complex clips. Currently the Blit, BlitBg and MaskBlit primitives have been modified to use the new native Region iteration and the performance improvement of these primitives when rendering with a complex clip is up to 500% improvement on Windows and up to 700% improvement on Solaris. The current code will be checked in for testing for the Mantis release but we may not have time to utilize the code in any more primitives in the Mantis timeframe. ###@###.### 2002-10-24
24-10-2002