Bug 238595 - SWTGraphics should support pushState() and restoreState() also if non-rectangular clipping is involved.
Summary: SWTGraphics should support pushState() and restoreState() also if non-rectang...
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 87776
Blocks:
  Show dependency tree
 
Reported: 2008-06-26 09:49 EDT by Alexander Nyßen CLA
Modified: 2011-01-29 07:49 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2008-06-26 09:49:03 EDT
When specifying clipping not via setClip(Rectangle), but via setClip(Path), currentState.relativeClip is set to null.

Within pushState(), the following check then causes a IllegalStateException to be thrown:
if (currentState.relativeClip == null)
		throw new IllegalStateException("The clipping has been modified in" + //$NON-NLS-1$
				"a way that cannot be saved and restored."); //$NON-NLS-1$
Comment 1 Alexander Nyßen CLA 2011-01-29 07:49:52 EST
In order to enable to preserve the clipping-state in case non-rectangular clipping is involved (specified via a path or even a region), we would - based on the current implementation - have to provide additional local Clipping implementations for path and region (one for rectangle is already there), which would have to support the calculation of intersections between arbitrary clippings (rectangle, region, and path). As path does not offer means to perform an intersection calculation, this is not achievable.

However, if SWT would support an intersection of clippings as required in bug #87776, we could change the implementation of Graphics to not calculate the clipping intersections locally, but to just keep track of all applied clippings since the last restoration of state and to re-apply them to the Graphics. As such, I regard this as being blocked by bug #87776.