Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 310697

Summary: Need a way to clip Path within the current clipping context
Product: [Tools] GEF Reporter: Alex Boyko <aboyko>
Component: GEF-Legacy Draw2dAssignee: Alex Boyko <aboyko>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, lgrahek
Version: 3.6   
Target Milestone: 3.6.0 (Helios) M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 310701    
Attachments:
Description Flags
proposed patch none

Description Alex Boyko CLA 2010-04-27 15:40:10 EDT
Created attachment 166245 [details]
proposed patch

To do a non-rectangular gradient fill one would do the following:
1. Clip path
2. Fill rectangular gradient

The Clip path (1) requires clipping the path in the context of the current clipping area, i.e. the intersection of current clipping area and the apth is the resultant client area. Currently this is not supported in Draw2D, and therefore if a shape within a scrolled viewport requires non-rectangular gradient fill and half of the shape is clipped the part that is supposed to be clipped is still visible.

I've tried to engineer RegionClipping within SWTGraphics, but it didn't scale well at all, because state pushing/popping/restoring creates state copies and hence clipping area, i.e. SWT Region needs to be cloned as well. Region creation is slow because it's a GDI resource and requires a native call. RegionClipping has slowed down painting significantly.

The alternative solution (patch for it is attached) is simpler but it doesn't support the case for non-rectangular clipping info in the states, which is fine for now.
Comment 1 Alex Boyko CLA 2010-04-28 10:24:59 EDT
Lidija has approved the patch. Fixed for 3.6