| Summary: | [Cocoa]GC.copyArea() doesn't work for StyledText | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Lakshmi P Shanmugam <lshanmug> |
| Component: | SWT | Assignee: | Lakshmi P Shanmugam <lshanmug> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, loskutov, lshanmug, mistria, niraj.modi, sravankumarl, twolf |
| Version: | 4.8 | Flags: | sravankumarl:
review+
niraj.modi: review+ |
| Target Milestone: | 4.9 RC2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| See Also: |
https://git.eclipse.org/r/128530 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=36bd428f1c9a3c2dfa7b0d8eab63495b292687e1 https://git.eclipse.org/r/128630 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=439ef5aad0500b5642b2b29398277de1e0fa3a3b |
||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 536234 | ||
(In reply to Lakshmi Shanmugam from comment #0) > GC.copyArea() is currently broken for StyledText. Regression in 4.9 or was it always the case? Is this Mac only issue? FWIW: * Fails in 4.8.0RC2 (20180531-0841) * Works in 4.7.3a (20180405-1200) Which OS? Mac? (In reply to Andrey Loskutov from comment #3) > Which OS? Mac? Of course. OS X 10.12.6, non-HiDPI display. Looks like it was broken in 4.8 by the fix for Bug 508129. (In reply to Lakshmi Shanmugam from comment #0) > GC.copyArea() is currently broken for StyledText. > > Modified Snippet 95 to use StyledText: If I run this snippet on GTK3 or GTK2, it shows me black rectangle on the second shell. I guess this is supposed to be not black :-) So this is broken on GTK2 and GTK3 too. Just tested, on Windows 7 this works. (In reply to Andrey Loskutov from comment #6) > (In reply to Lakshmi Shanmugam from comment #0) > > GC.copyArea() is currently broken for StyledText. > > > > Modified Snippet 95 to use StyledText: > > If I run this snippet on GTK3 or GTK2, it shows me black rectangle on the > second shell. I guess this is supposed to be not black :-) > > So this is broken on GTK2 and GTK3 too. Just tested, on Windows 7 this works. I thought this worked on GTK since the test for Bug 536234 uses this. Sravan, can you please verify on your GTK machine? It works for me on GTK3 with a scale of 1. In Hidpi mode I see a blank image (In reply to Sravan Kumar Lakkimsetti from comment #8) > It works for me on GTK3 with a scale of 1. In Hidpi mode I see a blank image I have no HiDpi monitor, just two monitors and KDE, and test is on the second one, and I see black second shell. Test_org_eclipse_swt_custom_StyledText is green in same environment. My GTK versions are: rpm -q gtk2 gtk3 gtk2-2.24.31-1.el7.x86_64 gtk3-3.22.10-4.el7.x86_64 Need to find a way to fix this without bringing back Bug 508129. Will investigate post M2. New Gerrit change created: https://git.eclipse.org/r/128530 Gerrit change https://git.eclipse.org/r/128530 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=36bd428f1c9a3c2dfa7b0d8eab63495b292687e1 New Gerrit change created: https://git.eclipse.org/r/128630 Gerrit change https://git.eclipse.org/r/128630 was merged to [R4_9_maintenance]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=439ef5aad0500b5642b2b29398277de1e0fa3a3b This has been fixed for Cocoa. I've opened Bug 538586 to track the bug on GTK. Verified in I20180906-0745 (In reply to Lakshmi Shanmugam from comment #16) > This has been fixed for Cocoa. I've opened Bug 538586 to track the bug on > GTK. Some SWT tests are using it successfully on GTK and Windows. Why do you think there is a bug for GTK? Also, the new bug you've opened says it targets OSX. (In reply to Mickael Istria from comment #18) > Some SWT tests are using it successfully on GTK and Windows. Why do you > think there is a bug for GTK? Also, the new bug you've opened says it > targets OSX. comment 6, comment 8, comment 9. |
GC.copyArea() is currently broken for StyledText. Modified Snippet 95 to use StyledText: public class Snippet95 { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Widget"); StyledText text = new StyledText(shell, SWT.MULTI); text.setText("hello"); text.setBounds(10, 10, 50, 50); Button button = new Button(shell, SWT.PUSH); button.setText("Capture"); button.pack(); button.setLocation(10, 140); button.addListener(SWT.Selection, event -> { Point textSize = text.getSize(); GC gc = new GC(text); final Image image = new Image(display, textSize.x, textSize.y); gc.copyArea(image, 0, 0); gc.dispose(); Shell popup = new Shell(shell); popup.setText("Image"); popup.addListener(SWT.Close, e -> image.dispose()); Canvas canvas = new Canvas(popup, SWT.NONE); canvas.setBounds(10, 10, textSize.x+10, textSize.y+10); canvas.addPaintListener(e -> e.gc.drawImage(image, 0, 0)); popup.pack(); popup.open(); }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }