Community
Participate
Working Groups
Created attachment 267677 [details] Test snippet with sample images to reproduce this issue. +++ This bug was initially created as a clone of Bug #508570 +++ The Image(Device, Image, int) copy constructor doesn't copy providers when the passed source image was created using below image constructors: Image(Device, ImageDataProvider) or Image(Device, ImageFileNameProvider) This issue was noticed while testing bug 496409 on Ubuntu, but going by the code issue would also exist on Windows(but haven't noticed this problem in real on Windows)
Problem is narrowed down and I will propose a patch for M7.
Note that the copy constructor needs to keep copying the *current* content of the image. It can additionally copy the image providers, but these should only be used after dynamic resolution switching. If someone modifies the image before creating a copy, then the drawing should be retained in the copy. Example: Add this to the snippet (right after creating the images): cross(simple); cross(one); cross(two); The cross(..) method: private static void cross(Image image) { Rectangle bounds= image.getBounds(); GC gc= new GC(image); gc.setLineWidth(4); // drawLine doesn't touch alpha, see bug 457904 gc.drawLine(0, 0, bounds.width - 1, bounds.height - 1); gc.drawLine(0, bounds.height - 1, bounds.width - 1, 0); gc.dispose(); }
New Gerrit change created: https://git.eclipse.org/r/94798
(In reply to Markus Keller from comment #2) > Note that the copy constructor needs to keep copying the *current* content > of the image. It can additionally copy the image providers, but these should > only be used after dynamic resolution switching. > > If someone modifies the image before creating a copy, then the drawing > should be retained in the copy. > > Example: Add this to the snippet (right after creating the images): > > cross(simple); cross(one); cross(two); > > The cross(..) method: > > private static void cross(Image image) { > Rectangle bounds= image.getBounds(); > GC gc= new GC(image); > gc.setLineWidth(4); > // drawLine doesn't touch alpha, see bug 457904 > gc.drawLine(0, 0, bounds.width - 1, bounds.height - 1); > gc.drawLine(0, bounds.height - 1, bounds.width - 1, 0); > gc.dispose(); > } On Windows and GTK we only maintain the content at *current* zoom(modified or not) which gets copied as part of copy constructor and we continue to do so. With proposed patch, we now try to make a complete copy of the image *current* contents including providers and currentDeviceZoom(on GTK as well)
Gerrit change https://git.eclipse.org/r/94798 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e1edaaeaaf56d38ecf87fe871bfaed8ada38e2a7
Resolving now.