Community
Participate
Working Groups
When running the following code fragment in rapid succession (in a PaintListener for example): Image image = new Image(Display.getCurrent(), 100, 100); GC imageGC = new GC(image); Transform transform = new Transform(imageGC.getDevice()); transform.translate(10, 10); imageGC.setTransform(transform); imageGC.setClipping(20, 20, 30, 30); SWTGraphics g = new SWTGraphics(imageGC); Rectangle r = new Rectangle(); g.getClip(r); System.out.println(r.toString()); The printed rectangle randomly oscillates between two values: Rectangle(20.0, 20.0, 30.0, 30.0) Rectangle(20.0, 20.0, 10.0, 30.0) It looks like some sort of a race condition. The graphics painted onto the Image through g are also incorrectly clipped most of the time. Manually overwriting the clipping on the SWTGraphics after it is constructed solves the issue: g.setClip(new Rectangle(20, 20, 30, 30));
The problem was not present with the GTK2 SWT backend, only appears with the GTK3 backend.