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

Bug 259698

Summary: The Graphics API issue on the eclipse 3.4M5
Product: [Tools] GEF Reporter: Dazheng Gao <gump_gao>
Component: GEF-Legacy Draw2dAssignee: Marc Gobeil <mgobeil>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, hudsonr
Version: unspecified   
Target Milestone: 3.5.0 (Galileo)   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
The LEDFigure none

Description Dazheng Gao CLA 2008-12-26 05:18:15 EST
When I add two RetangleFigure to the Layer, but one is the advace graphics, and the other is not.
Look like the reconcileHints methos of the SWTGraphics is error,
if ((changes & ADVANCED_GRAPHICS_MASK) != 0) {
			if ((hints & ADVANCED_GRAPHICS_MASK) != 0 && !gc.getAdvanced())
				gc.setAdvanced(true);

should move before 

if (changes == 0)
	return;


The other issure is when the graphics is advanced and the XORMode is true and the alpha is 255, In the GC class, maybe the native method Gdip.Graphics_FillRectangle has some issures. Is not same to the no adavaced graphics. The alpha is not use and the background is black(The background color is not use).(See method of fillRectangle GC class )
Comment 1 Randy Hudson CLA 2009-01-05 11:43:25 EST
> When I add two RetangleFigure to the Layer, but one is the advace graphics, and
> the other is not.

What does this comment mean? Are you using the new LineAttributes API?
Comment 2 Anthony Hunter CLA 2009-01-05 13:00:05 EST
I suppose another question is why you are using 3.4M5 and not 3.4 GA or better 3.4.1?
Comment 3 Dazheng Gao CLA 2009-01-05 23:46:11 EST
I don't use the LineAttributes.I new a figure, annf add two RetangleFigures to this figure.And do nothing.

When the two RetangleFigures paint You will find one is the  advace graphics, and the othe is not.
Comment 4 Anthony Hunter CLA 2009-01-06 10:19:44 EST
Can you provide an example snippet?
Comment 5 Dazheng Gao CLA 2009-01-07 00:51:28 EST
I write a test in the LEDFigure.Please download the attachment.Replace this class to the logic LEDFigure.Run the logic , add a LED to the diagram, you watch the print infomation, although the graphics is advanced, but the gc one is advanced, this othe is not.
Comment 6 Dazheng Gao CLA 2009-01-07 00:52:09 EST
Created attachment 121753 [details]
The LEDFigure
Comment 7 Randy Hudson CLA 2009-01-07 11:50:25 EST
Can you reproduce this in 3.4?  The code you are suggesting rearranging is old and hopefully worked previously.  Also, it provided a slight optimization.
Comment 8 Dazheng Gao CLA 2009-01-07 22:31:30 EST
gef version or logic version? can you run my example, you can test it follow the code.You want to add two figure to a parent, and all setAlpha.you will find when paint the gc of the SWTGraphics is different advanced. 
Comment 9 Marc Gobeil CLA 2009-01-08 11:35:52 EST
Dazhen's definitely found something wrong here.  Using his test, I can trace it to a point in SWTGraphics.checkGC(), the second fillShape() call from LEDFigure, where the applied state and current state hints match (suppressing the call to reconcileHints()), but the gc's advanced state doesn't match what's in the current state hint.

Will continue to dig deeper...
Comment 10 Marc Gobeil CLA 2009-01-30 16:30:43 EST
(In reply to comment #0)

> The other issure is when the graphics is advanced and the XORMode is true and
> the alpha is 255, In the GC class, maybe the native method
> Gdip.Graphics_FillRectangle has some issures. Is not same to the no adavaced
> graphics. The alpha is not use and the background is black(The background color
> is not use).(See method of fillRectangle GC class )
> 

Bug 262797 addresses the XORMode issue by setting Shape into non-advanced mode when drawing XOR fill/outline.  It turns out XORMode is a non-advanced only feature, and has been deprecated in SWT due to lack of support on all platforms (most notably Mac OSX).  GEF's api doesn't reflect this deprecation of the underlying function, but probably should.
Comment 11 Anthony Hunter CLA 2009-07-27 13:40:48 EDT
I think this can be resolved, right Marc?
Comment 12 Marc Gobeil CLA 2009-07-27 16:43:59 EDT
(In reply to comment #11)
> I think this can be resolved, right Marc?
> 

yeah, it's effectively a duplicate of Bug 262797.

*** This bug has been marked as a duplicate of bug 262797 ***