Summary: | [GTK][Win32][HiDPI] Image(Device, Image, int) constructor doesn't copy providers | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Niraj Modi <niraj.modi> | ||||
Component: | SWT | Assignee: | Niraj Modi <niraj.modi> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | arunkumar.thondapu, daniel_megert, lshanmug, ma.becker, markus.kell.r, peter, sravankumarl | ||||
Version: | 4.6 | ||||||
Target Milestone: | 4.7 M7 | ||||||
Hardware: | PC | ||||||
OS: | All | ||||||
See Also: |
https://git.eclipse.org/r/94798 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e1edaaeaaf56d38ecf87fe871bfaed8ada38e2a7 |
||||||
Whiteboard: | |||||||
Bug Depends on: | 508570 | ||||||
Bug Blocks: | 495269, 495782 | ||||||
Attachments: |
|
Description
Niraj Modi
2017-04-06 08:01:46 EDT
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 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. |