Skip to content

Commit

Permalink
Fix oval rendering artifacts in OR+XOR gate
Browse files Browse the repository at this point in the history
Signed-off-by: Amadeus1791 <[email protected]>
  • Loading branch information
Sezuan01 authored and azoitl committed Feb 12, 2025
1 parent a0edaa8 commit ef9a11e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*******************************************************************************/
package org.eclipse.gef.examples.logicdesigner.figures;

import org.eclipse.swt.SWT;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PointList;
Expand Down Expand Up @@ -61,6 +63,7 @@ protected void paintFigure(Graphics g) {
r.translate(4, 4);
r.setSize(22, 18);

g.setAntialias(SWT.ON);
g.setLineWidth(2);

// Draw terminals, 2 at top
Expand All @@ -70,11 +73,10 @@ protected void paintFigure(Graphics g) {
// Draw the bottom arc of the gate
r.y += 8;

r.x -= 1;
r.width--;
g.fillOval(r);
r.width -= 2;
r.width--;
r.height--;
r.x++;

g.drawOval(r);
g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2, r.bottom() + 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*******************************************************************************/
package org.eclipse.gef.examples.logicdesigner.figures;

import org.eclipse.swt.SWT;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PointList;
Expand Down Expand Up @@ -73,6 +75,7 @@ protected void paintFigure(Graphics g) {
r.translate(4, 4);
r.setSize(22, 18);

g.setAntialias(SWT.ON);
g.setLineWidth(2);

// Draw terminals, 2 at top
Expand All @@ -92,8 +95,10 @@ protected void paintFigure(Graphics g) {
clipRect.width += 2;
clipRect.y = r.y + 6;
g.clipRect(clipRect);
r.width--;

g.fillOval(r);
r.width -= 2;
r.width--;
r.height--;
g.drawOval(r);
g.popState();
Expand Down

0 comments on commit ef9a11e

Please sign in to comment.