Community
Participate
Working Groups
Created attachment 102717 [details] fix patch for future reference There is a high chance that the embedded image on the diagram is clipped by 1 pixel on the top and/or on the left. It is easy to spot the issue with a circular shape SVG image. RenderHelper does the scaling of the image to render an embedded image such that the quality of image doesn't suffer the scaling, this is done for SVG images. When render helper performs the scaling it doesn't take into account the fractionalX and fractionalY defined on scaled graphics and hence the clipping rectangle and the actual area where the image is drawn can be different and, therefore, 1 pixel of the image might be clipped. I'm attaching the patch that fixes the issue. However, it may break GMF clients, which use ScaledGraphics wrapped around MapModeGraphics or any other GMF graphics implementing DrawableRenderedImage interface. The best way to fix would probably be making the interface public as well as having GMF ScaledGraphics implementing this interface.
Created attachment 141130 [details] proposed patch A possible patch that fixes the issue. Changed RenderedMapModeGraphics and RenderedScaledGraphics such that the target rectangle is scaled with fractional parts included. RenderHelper only works correctly for RenderedXXXGraphics, hence swept the runtime code and replaced ScaledGraphics with RenderedScaledGraphics and MapModeGraphics with RenderedMapModeGraphics where appropriate. The call to listener.paintFigureWhileRendering never has the right graphics object (most of the time it's SWTGraphics) and hence the red rectangle with cross is either never visible (clipped) or just to big. Therefore, it is better that we don't paint at all or just paint something at the RenderHelper level. For now nothing is painted what not rendered yet image. I'd like to raise a bug for 2.3 to get rid of RenderedXXXGraphics and merge them with ScaledGraphics and MapModeGraphics. Move most of classes from draw2d.ui.render to draw2d.ui plugin. Anthony, can you please review this patch and let me know what you think? Thanks!
I cannot see anything wrong with the patch. Only two administrative comments: I do not get why we added +@SuppressWarnings("restriction") to SWTDiagramPrinter. If it is to get rid of the two warnings that were already there for gc.setXORMode, I would not add these @SuppressWarnings, we need to know we are using deprecated methods. You will need to add @since 1.2 to DiagramScalableFreeformLayeredPane.createMapModeGraphics DiagramScalableFreeformLayeredPane.createScaledGraphics
Thanks! Added @since 1.2 blocks The restriction was just a left over. The package hosting the RenderedXXXGraphics was made visible to printing plugin, so I just forgot to remove the suppress restriction i put there previously. Committed to HEAD and maintenance.
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug