Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 273541 - Shape border/fill misaligned and no longer anti-aliased
Summary: Shape border/fill misaligned and no longer anti-aliased
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5.0 (Galileo) M7   Edit
Assignee: Marc Gobeil CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 276682 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-23 23:01 EDT by Eric Jain CLA
Modified: 2010-03-17 03:43 EDT (History)
4 users (show)

See Also:


Attachments
original (2x) (4.25 KB, image/png)
2009-04-23 23:01 EDT, Eric Jain CLA
no flags Details
new (2x) (4.31 KB, image/png)
2009-04-23 23:02 EDT, Eric Jain CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Jain CLA 2009-04-23 23:01:43 EDT
Created attachment 133048 [details]
original (2x)

Build ID: I20090313-0100

Steps To Reproduce:

After upgrading Eclipse from 3.4 to 3.5M6 (and GEF from 3.4.2 to 3.5.0M6), figures in a graphical editor look ugly (see attached screenshots). If I revert the GEF and Draw2D libraries to the old versions, everything looks fine again.

This is the code for creating the circle figures:

public class CircleEditPart extends AbstractGraphicalEditPart {

  @Override
  protected IFigure createFigure() {
    final Ellipse figure = new Ellipse();
    figure.setSize(25, 25);
    figure.setLineWidth(1);
    figure.setForegroundColor(ColorConstants.darkGray);
    figure.setBackgroundColor(ColorConstants.lightBlue);
    figure.setFill(true);
    return figure;
  }
}

The circles are contained in another figure that switched anti-aliasing on like so:

  @Override
  protected IFigure createFigure() {
    IFigure figure = new Panel() {
      @Override
      public void paint(Graphics graphics) {
        graphics.setAntialias(SWT.ON);
        super.paint(graphics);
      }
    };
    figure.setBorder(new MarginBorder(10));
    FlowLayout layout = new FlowLayout(false);
    layout.setMajorSpacing(10);
    layout.setMinorSpacing(10);
    figure.setLayoutManager(layout);
    return figure;
  }

Not enabling the anti-aliasing in with the new version has no effect; in the old version the lines are less smooth (as expected) but the shape filling is still properly aligned.
Comment 1 Eric Jain CLA 2009-04-23 23:02:12 EDT
Created attachment 133049 [details]
new (2x)
Comment 2 Eric Jain CLA 2009-05-06 19:25:07 EDT
Looks like the alignment issue no longer occurs in 3.5M7. The aliasing however is still not working.
Comment 3 Marc Gobeil CLA 2009-05-07 14:56:39 EDT
I think this has to do with a problem where the state inside SWTGraphics isn't properly synchronized with the SWT GC when it's popped from the stack.  There's a bugzilla that discusses some of my investigation to that, don't have the reference number off the top of my head, but will look it up.

This can be assigned to me.
Comment 4 Marc Gobeil CLA 2009-05-27 15:07:37 EDT
duplicate of bug 276682 (which now has a patch)
Comment 5 Marc Gobeil CLA 2009-05-27 15:08:24 EDT

*** This bug has been marked as a duplicate of bug 276682 ***
Comment 6 Anthony Hunter CLA 2009-05-28 12:39:49 EDT
Unduplicating since the issue is in GEF and not GMF.
Comment 7 Anthony Hunter CLA 2009-05-28 12:41:38 EDT
*** Bug 276682 has been marked as a duplicate of this bug. ***
Comment 8 Anthony Hunter CLA 2009-05-28 12:42:49 EDT
Fixed in HEAD using Marc's patch in Bug 276682.

Comment 9 clmo CLA 2010-03-17 03:43:04 EDT
I still have the problem with draw2d version 3.5.2.v20091126-1908.
If the lineWidht >=2 the border is not drawn correct. With version 3.4.x everything is ok.