| Summary: | Purple-icons drawing image with cairo in Solaris-sparc (big-endian) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Silenio Quarti <Silenio_Quarti> | ||||
| Component: | SWT | Assignee: | Silenio Quarti <Silenio_Quarti> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | eclipse.felipe | ||||
| Version: | 3.6 | Flags: | eclipse.felipe:
review+
|
||||
| Target Milestone: | 3.6.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Solaris-GTK | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 175586 [details]
fix
Need to consider the native endianness when creating the cairo surface. Fixed > 20100730. Felipe, please review for 3.6.1. Same patch applies. Patch has been released to R3_6_maintenance. |
import org.eclipse.swt.SWT; import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; public class Test { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; Image image = new Image(gc.getDevice(), 100, 100); GC imageGC = new GC(image); imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_RED)); // imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_GREEN)); // imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_BLUE)); imageGC.fillRectangle(image.getBounds()); imageGC.dispose(); ImageData data = image.getImageData(); for (int y = 0; y < data.height; y++) { for (int x = 0; x < data.width; x++) { data.setAlpha(x, y, 0xFF); } } image.dispose(); image = new Image(gc.getDevice(), data); gc.setAdvanced(true); System.out.println(gc.getAdvanced()); gc.drawImage(image, 100, 100); image.dispose(); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }